System and method for dynamic image recognition

ABSTRACT

A system and method for object inspection that includes an image recognition program stored on a tangible medium for classifying and subclassifying regions of interest on an image. The image recognition program can be used in an image inspection system to determine defects on objects such as printed wiring assemblies. The image recognition program is executable to collect raw image data, segment out rectangular regions of interest that can be component sites defined by CAD data, preprocess each region of interest by scaling, gain and offset correction, and gamma correction, generating a set of image spaces for each region of interest using a set of spatial image transforms, generating features on the image spaces, scoring the features, comparing the feature scores to a knowledge base of feature scores to make a class determination for the features, generating a presence/absence decision confidence for the features, calculating a class determination and decision confidence for each region of interest. The class determinations can include present or absent, and right or wrong polarity. Another aspect of the image recognition software includes the ability to subclassify the defects. Another aspect of the present invention includes the ability to incrementally train the existing knowledge base as more images are processed.

TECHNICAL FIELD OF THE INVENTION

[0001] The present invention relates generally to the fields of imageprocessing, pattern recognition, and machine vision, and moreparticularly, to a system and method, including software programming,for automated dynamic image recognition for the detection andclassification of defects on printed wiring boards using visual imagingand analyses of the visual imaging.

BACKGROUND OF THE INVENTION

[0002] Most manufactured products go through quality control inspectioncycles in an attempt to reduce the number of defective products thatleave the manufacturing facility. Especially in industries incorporatingelectronic printed wiring assemblies (PWAs), visual inspections areoften performed at several points in the manufacturing cycle of the PWA.For PWA inspections, component level defects that are examined for byvisual inspection include missing, misoriented, misaligned, damagedcomponents, and foreign material.

[0003] Automated inspection of objects, including PWAs, has been triedin many manufacturing industries to attempt to 1) reduce the number ofdefects that escape detection and false defects reported in human visualinspections, 2) reduce the time required to perform inspections andtherefore reduce the overall manufacturing cycle time, and 3) to reducethe labor costs associated with manual visual inspections. Machinevision systems have become more widespread in industries requiring rapidinspection of objects to determine whether the object is spaciallycorrect. Several automated inspection methodologies have beencommercialized, with varying degrees of success, for PWA inspection todetect component level defects. These include golden board correlation,template correlation, pattern recognition with fixed feature sets, andstatistical feature models. Very often, specialized hardware andsoftware techniques are used in conjunction with these methods toincrease the proficiency of these methodologies.

[0004] However, each of these previously developed methodologies provesinadequate in a real world inspection scenario because each arepredisposed to the visual characteristics of their “good board” models(e.g., geometric patterns or statistical models). Thus, in order tomaintain effective defect detection, the PWAs inspected must remainfairly consistent. However, the image of a PWA and particular areas of a“good” PWA can change from run to run and even within a single run ofboards (e.g., if a different vendor component is used). In reality,there are countless variations of PWAs that are correctly assembled.These conventional systems do not adequately compensate for the realworld variations that will still result in a good board.

[0005] Furthermore, each of these previously developed systems andmethods require an extensive amount of programming expertise to set upand maintain the inspection systems. The-programming must typicallyinclude elaborate image processing algorithm configurations for each newpart, which, depending on the algorithm used, can include as many as 150distinct parameters. Typically, these complex problems cannotautomatically switch between part types, the part libraries cannot beported to new PWAs or to other inspection systems, and each new boardcan require in excess of 80 hours of initial set-up time.

[0006] As mentioned, specialized hardware and/or software programming isoften used to reduce image variability for these previously developedinspection systems to improve the system performance. However, specialhardware and/or software programming typically 1) increase thecomplexity for the user and 2) limit the scope of applicability for theinspection system. For example, the modifications may make one class ofdefect easier to detect, while reducing the effectivity or eveneliminating the ability to detect other classes of defects. Thus, inorder to inspect for all relevant component defects, severalmodifications must be made and the inspection system must image the samePWA multiple times to get full defect coverage, thus increasing both thecomplexity and the cost of the inspection system.

[0007] For example, some previous systems are model-based approachesthat use software programming to model the object under inspection (suchas a PWA with components). Model-based approaches will often build avery exact model of the components by outlining the edges of componentson the PWA, perhaps including an edge-enhancement algorithm, andperforming a connectivity step to form a line segment. However, as thelines (edges) become more obscure (due to gaps or less distinctgray-scale differentiation between pixels), the software programs andalgorithms become significantly less effective and thereforeincreasingly more complex and expensive.

[0008] As shown, these previously developed inspection systems tend tobe non-robust and inflexible. Accordingly, these systems consistentlyproduce high numbers of false alarms (i.e., indicating defects when noneexists) which cannot be reduced to acceptable levels without causinghigh numbers of false passes (i.e., indicating a PWA is good when it hascomponent defects). In addition, these systems tend to have relativelyhigh operating costs, maintenance costs, and operator training costs.

[0009] Additionally, previously developed machine vision inspectionsystems, most (if not all) simply determine whether a part is present orabsent and some make a determination of polarity. However, these systemsdo not perform an additional analysis of the presence/absencedeterminations to sub-classify defects to determine not only whether thecomponent is present, but also whether the component is misoriented,misaligned, damaged, or surrounded by foreign material. While theseprior art systems can often identify a defect, they cannot classify thedefect to aid in the troubleshooting and improvement of the PWA process.

SUMMARY OF THE INVENTION

[0010] The present invention provides an image recognition system andmethod that substantially eliminates or reduces disadvantages andproblems associated with previously developed inspection systems andmethods that utilize imaging technology, including those systems andmethods used for inspection of printed wiring boards.

[0011] The present invention provides an image recognition programstored on a tangible medium for classifying and subclassifying regionsof interest on an image. The image recognition program can be used in animage inspection system to determine defects on objects such as printedwiring boards.

[0012] More specifically, the image recognition program is executable tocollect raw image data, segment out rectangular regions of interest thatcan be component sites defined by CAD data, preprocess each region ofinterest by scaling, gain and offset correction, and gamma correction,generate a set of image spaces for each region of interest using a setof spatial image transforms, generating feature scores on the imagespaces, scoring the features, comparing the features to a knowledge baseof feature scores to make a class determination for the features,generating a presence/absence decision confidence for the features,calculating a class determination and decision confidence for eachregion of interest. This will determine if the component within theregion of interest is correct or defective including whether a part ispresent or absent and whether it has the correct polarity.

[0013] Another aspect of the image recognition software includes theability to perform a relative confidence determination to flag defectsand extended relative confidence to subclassify the defects. In anotheraspect of the present invention, class determination, decisionconfidences, relative decision confidences and extended relativedecision confidences can be added to the existing knowledge base to“train” the knowledge base to accept or reject additional defect classesand subclasses.

[0014] The present invention provides an important technical advantageby providing an automated object inspection system that, in addition todetermining whether a component is present and has the correct polarity,can also determine various sub-classifications of defects, includingmissing, misoriented, misaligned, damaged components, and foreignmaterial.

[0015] The present invention provides another important technicaladvantage by using software programming in combination with visualimaging of an object to perform improved defect detection on the imagedobject. The unique software~programming of the present invention buildsknowledge bases that can be refined as additional images are processedthrough the system. The unique programming of the present invention alsoprovides an analysis of the knowledge bases to provide a relativeconfidence analysis of whether a component on the object is present orabsent.

[0016] The present invention provides a further technical advantage byperforming an extended confidence analysis using software programming toprovide defect sub-classification analyses.

[0017] The present invention provides another technical advantage byreducing the number of false alarm defect detections as well as thenumber of defect escapes (defects that pass through the inspectionsystem.) The self-organizing knowledge bases and adaptive algorithms inthe software programming enhance feature selection by using the mostdiscriminating features to represent a defect class, rather than beingpredisposed by the operator as to which features should be used fordefect determination. The relative confidence and extended confidenceanalyses of the present invention further reduce the number of defectescapes.

[0018] The present invention provides yet another technical advantage byminimizing training time of the defect detection system. The presentinvention can create a knowledge base more rapidly (e.g., minutesinstead of hours/days for conventional systems). Furthermore, new defectclasses and part types can be updated with single example incrementaltraining, and the performance of the system improves incrementally witheach additional PWA imaged. The combination of minimal knowledge basecreation time with incremental training allows for a faster path tohigher quality PWAs.

[0019] The present invention provides still another technical advantageminimizing the required inspection system operator skill level. Theknowledge bases of the present invention are trained by showing examplesof the objects to be inspected. Unlike conventional inspection systems,an operator using an inspection system incorporating the presentinvention does not need any image processing training, and will onlyrequire minimal system operation experience.

[0020] The present invention provides another advantage by providingextendible, low complexity, highly parallel algorithms in the softwareprogramming. The algorithms are not tailored for specific inspectionapplications or a particular data input, and therefore can be extendedto any machine vision and input imagery applications. The relativesimplicity of the algorithms provide ease of maintenance, while theparallel nature provides opportunities for increases in speed asparallel processing architectures develop. The present inventionprovides an inspection system that does not perform every inspectionbased on a set, predisposed model.

BRIEF DESCRIPTION OF THE DRAWINGS

[0021] For a more complete understanding of the present invention andthe advantages thereof, reference is now made to the followingdescription taken in conjunction with the accompanying drawings in whichlike reference numerals indicate like features and wherein:

[0022]FIG. 1 is a diagram of an exemplary imaging system incorporatingthe image recognition software of the present invention;

[0023]FIG. 2 is a flow chart of one embodiment of an imageclassification process of the present invention;

[0024]FIG. 3 is a flow chart of one embodiment of the training that isperformed by the image recognition software of the present invention;

[0025]FIG. 4 shows a raw object image including a number of regions ofinterest;

[0026]FIG. 5 shows a graph of light intensity versus time to illustrategain and offset correction on an image;

[0027]FIG. 6 is a graph of pixel input versus pixel output to illustrategamma correction on an image;

[0028]FIG. 7 shows an example eight bit gray scale image of ten by tenpixels with the pixel intensity for each of the one hundred pixels;

[0029]FIG. 8 illustrates a gray scale reduction methodology that can beperformed on gray scale images;

[0030]FIG. 9 is a reduced gray scale image of the image of FIG. 7;

[0031]FIG. 10 is the first order derivative magnitude image and thereduced first order derivative magnitude image as derived from the imageof FIG. 7;

[0032]FIG. 11 is the first order derivative direction image as derivedfrom the image of FIG. 8;

[0033]FIG. 12 is the second order derivative magnitude image and thereduced second order derivative magnitude image as derived from theimage of FIG. 10;

[0034]FIG. 13 is the second order derivative direction image as derivedfrom the image of FIG. 10;

[0035]FIG. 14 is a first clustering image of the image of FIG. 9 toillustrate the clustering methodology of the present invention;

[0036]FIG. 15 is a first iteration clustering image of the image of FIG.9;

[0037]FIG. 16 is a second iteration clustering image of the image ofFIG. 9;

[0038]FIG. 17 is a third iteration clustering image of the image of FIG.9;

[0039]FIG. 18 is a fourth iteration clustering image of the image ofFIG. 9;

[0040]FIG. 19 is a first sub-iteration of the clustering image of FIG.14;

[0041]FIG. 20 is a second sub-iteration of the clustering image of FIG.14;

[0042]FIG. 21 is the final clustering image derived from FIG. 9 based onone embodiment of the clustering methodology of the present invention toillustrate feature generation for a region of interest;

[0043]FIG. 22 is an exemplary feature bounding box resulting fromclustering according to the present invention;

[0044]FIG. 23 is a series of number lines for each of the featuresgenerated in FIG. 21 to illustrate an embodiment of the pruningtechniques of the present invention.;

[0045]FIG. 24 shows the four number lines for the pruned features ofFIG. 21 and illustrates the scoring of test features on a test region ofinterest to determine feature classification;

[0046]FIGS. 25A and 25B includes exemplary graphs of raw confidencevalues and relative confidence upper and lower bounds to illustraterelative confidence error boundary determination;

[0047]FIG. 26 is an exemplary region of interest that illustrates theextended relative confidence methodology of the present invention; and

[0048]FIG. 27 is a listing of pseudo-code for one embodiment of theimage recognition software of the present invention.

DETAILED DESCRIPTION OF THE INVENTION

[0049] Preferred embodiments of the present invention are illustrated inthe FIGUREs, like numerals being used to refer to like and correspondingparts of the various drawings.

[0050] The dynamic image recognition system and method of the presentinvention allows for automatic detection and classification of regionsof interest (ROI) on an image of an object, for example a printed wiringboard (PWA) that is assembled with components. The present invention cancreate and interpret a unique set of visual features to describe a“good” PWA that does not contain manufacturing defects. By using amachine vision system and software programming, the present inventioncan use a set of visual features that is not necessarily the one mostreadily observed by the human visual system.

[0051] The present invention uses a machine vision system to take visualimages or pictures of the object, for example a PWA, and uses imagerecognition software programming that is executable to buildself-organizing, adaptive knowledge bases that are used to findout-of-tolerance features within the ROI's for the images on subsequentPWAs. These knowledge bases are data bases stored in computer-readableform on a computer-readable storage medium. Using software programmingthat is also stored on a computer-readable medium and executable using acomputer processor, these out-of-tolerance ROI's are examined todetermine if they represent defects on the PWAs. Each subsequent imageof a PWA can be used to update and improve the existing knowledge baseregarding the features and regions of interest for that particular PWA.

[0052] The visual images are initially analyzed to determine whethercomponents on a PWA are present or absent, and if present, whether thecomponents are assembled with the proper polarity. The polaritydetermination is usually made from a polarity identifier contained onthe component. A decision confidence analysis can then be performed onthe raw presence/absent determinations to provide a confidence level ofwhether the component is absent or present. The present invention canthen perform relative confidence analysis for a particular class ofdefects to further “detect” whether a component assembled on the PWAexhibits a defect. The presence/absence confidence determinations-canthen be further processed to find defect sub-classes (i.e., defectsbeyond simply present or absent) using what will be described herein asan extended confidence analysis. Using the extended confidence analysismethodology contained in software programming, the dynamic imagerecognition software of the present invention can detect and classifycomponent level sub-class defects such as foreign material on thecomponent, critically skewed components, damaged components, wrongcomponents at a particular position, tombstoned components, andbillboarded components. The presence/absence analysis, relativeconfidence analysis, and extended confidence analysis are all performedby the image recognition software programming of the present invention.

[0053] A present/absence analysis is a determination of whether acomponent is actually assembled (i.e., “present”) on the PWA or not(i.e., “absent”). The “decision confidence” analysis is a measure of thelevel of confidence the present invention has in that determination. The“relative confidence” is a statistic that provides a nominal measure anda range that models how close the presence/absence decision confidencesare to typical ROI decision confidences contained in the ROI knowledgebase. The presence/absence relative confidence statistic provides basisto determine when images have deviated from the norm. The “extendedconfidence” analysis is a further determination of defect sub-classes.Thus, not only can the present invention determine that a component ispresent, but deviations from the image norm can also allow adetermination of defects on a present component. For example, while thecomponent may be present and have the correct polarity, the componentmay be critically skewed, and certain understood deviations of theextended relative confidence can lead to detection of this defect.

[0054] Using the extended confidence software programming, the presentinvention can subclassify defects found during the presence/absenceanalyses into the following component level defect subclasses:critically skewed components, tombstoned components, billboardedcomponents, damaged components, wrong components, and foreign materialon the PWA.

[0055] One of the unique aspects of the present invention is theself-organizing nature of the knowledge base analysis algorithms. Theknowledge bases build up the relative confidence thresholds autonomously(i.e., no relative confidence thresholds are pre-programmed or pre-setby humans). Certain parameters can be pre-programmed to enhance thedetection accuracy and speed, such as the minimal feature size. Forexample, the operator can set a sensitivity level (e.g., the percentageconfidence that will trigger an “absent” score) to a level that issignificant to the operator. In addition, the present invention allowsthe operator to adjust the sensitivity during inspection to overcomephysical limitations of the inspection system. However, relativeconfidence thresholds are not preset; rather, these relative confidencethresholds are built and continuously updated by the system duringinspection or processing of the parts or ROIs.

[0056]FIG. 1 is a diagram of one embodiment of an automated visualinspection station, indicated generally at 160, that can incorporate theimage recognition software 10 to detect and classify defects in printedwiring assembly according to the present invention. Exemplary station160 includes a platform 162 and vibration isolated subplatform cradle163 constructed from metal components to provide physical support forstation 160. A pair of guides 164 are mounted on subplatform 163 andprovide a path for populated printed wiring assemblies 166. A stop 168can be used to stop each assembly 166 at the appropriate position forinspection, and a thumper 169 can be used to position assembly 166against one of guides 164. Guides 164, stop 168 and thumper 169 form amaterial handling system for assemblies 166. In the FIG. 5 embodiment,the material handling system is 18 inches wide by one meter long with atwo speed, reversible conveyor to handle assemblies 166 and has anindustry-standard SMEMA interface built into platform 162 forinterfacing with other components of a manufacturing line.

[0057] Station 160 further includes a light source 170 which provideslight for illuminating assemblies 166 under inspection. Light source 170can include any number of light sources, including a FOSTEC DC regulated150 watt source with analog control and long life quartz Halogen bulbs(DDL type). Station 160 also includes a camera 172 that receives animage through an optic 174. Camera 172 can be a DALSA CL-E2 2048A TDIline scan camera with a VISION 1 PS1 linear power supply for CL-E2.Optic 174 can be an INVARITAR telecentric optic with 0.37× magnificationover a 72 millimeter field of view (FOV). As shown, the light generatedby light source 170 is split to two heads 176 through a bifurcatedoptical fiber 178. The heads 176 can be FOSTEC 6 inch line heads withcylindrical lenses. Light source 170, camera 172, optic 174, heads 176and optical fiber 178 together form an imaging system for scanning andacquiring images of assembly 166. Because of the structured directedlight provided by heads 176, three-dimensional spatial information canbe extracted/computed from the intensity of the reflected light duringscans.

[0058] Station 160 has a precision positioning system associated withthe imaging system. The precision positioning system includes a threadedprecision guide 180 having a motor 182 and a threaded precision guide184 having a motor 186. (In other implementations, guides 184 and 186could be, for example, pneumatic, hydraulic or magnetic.) Motors 182 and186 include motor drive units which can be simultaneously controlled bya two-axis controller in interface devices 188. These components allowthe imaging system to be moved across assembly 166 to scan in an imageof assembly 166. The threaded precision guides 180 and 184 can be DAEDAL406 series linear stages (e.g., 16 and 20 inch) with precision linearencoders and two pitch lead screws. Motors 182 and 186 can be two ZETAmotor drives (one per axis) controlled by COMPUMOTOR 6200 Series Twoaxis indexers.

[0059] Interface devices 188, which include optical relays for digitalcontrol signals and digital/analog converters for analog controlsignals, interface between a computer system 190 and the variouscontrolled components. Computer system 190 provides a processing andcontrol engine for operating inspection station 160. Computer system 190receives status information and provides control signals as well ascommunicating with peripherals 192. Computer system 190 can be anIndustrial Computer Source rack mounted chassis having a single boardcomputer with an INTEL PENTIUM PRO 200-450 MHz (or higher) processor andother typical computer components. Interface devices 188 can include a6200 indexer interfacing through a standard RS232 serial port andcomputer boards and digital-to-analog and OPTO 22 interface cards.

[0060] Camera 172 can be controlled by a data I/O card in computer 190,and light source 170 can be controlled by multi-functional I/O PWB witha dual D/A upgrade. Specifically, the data I/O card can be a MATROXINTERNATIONAL camera interface card (RS 422). An associated processingaccelerator card (described above) can be a MATROX INTERNATIONAL GENESIS64/8 and MATROX INTERNATIONAL GPRO 16/8 processing card set thatcommunicates via a high-speed backplane. With a MATROX INTERNATIONALGENESIS card, additional MATROX INTERNATIONAL GPRO cards can be added upto 6 total to increase the processing capacity. Peripherals 192 caninclude a 17 inch color monitor, standard keyboard and mouse/trackball,and a 4 Gbyte DAT tape drive. The network interface of computer system190 (not shown in FIG. 1) can be a 100 Mbit (100 BASE T) Ethernet card.

[0061] It should be understood that the image recognition software 10 ofthe present invention can be used with a variety of image producingmechanisms in addition to a camera. For example, the image recognitionsoftware 10 could be used in conjunction with images produced frominfrared, x-ray systems, casoes, 3-D sensor maps, or other imagingdevices. It should also be understood that the object imaged by thepresent invention can include any object that, when imaged, producesdiscernible features.

[0062]FIG. 2 is a flow chart of one embodiment of an automatedinspection process implementing the image recognition software 10 of thepresent invention. As shown, at step 194, the image recognition softwareprogram 10 is initiated, the operation mode is set at step 196, and theexisting knowledge base (from either prior imaged objects or fromtraining as described in FIG. 2) is loaded at step 198. At step 200, thestation acquires image data from scanning the object being inspected.The image data from the object is then pre-processed in step 202. Afterpreprocessing the image data, the image is described by selectedfeatures in step 204. The features are then analyzed, in step 206, suchthat the ROI is analyzed in context with the system knowledge base. Instep 208, defects in ROIs are identified and classified.

[0063] In step 210, the image recognition software determines whetherthe relative confidence in the classification is above a presetthreshold. If so, the station checks, in step 212, whether analysis ofthe object is complete. If the analysis is complete, the processcontinues at step 214 with the ejection of the imaged object from theinspection station and obtaining a new object to inspect.

[0064] If, in step 210, confidence was not above the threshold, then theprocess continues at step 215. The image recognition software thenperforms an analysis to determine whether the extended relativeconfidence for the classification is above a preset threshold. In step216, the operator is alerted and provided with the station's best optionas to the proper classification. In step 218, the station acceptsconfirmation of the best option by the operator or accepts an alternateclassification by the operator. Then, in step 220, the station addsinformation to the knowledge base as necessary to accomplish incrementallearning based upon the operator's input. The process then continues atstep 212 as discussed above.

[0065]FIG. 3 is a flow chart illustrating the training performed by theimage recognition software 10 of the present invention that is used tobuild the knowledge base that is loaded in FIG. 2. The training of FIG.3 is done on new objects (e.g., printed wiring assemblies) that have notbeen previously imaged to build the initial knowledge base that is usedlater to make classification determinations. The image recognitionprogram 10 is initiated at step 222 and the “create new knowledge base”option is selected and named by an operator (using, for example, agraphical user interface) at steps 224 and 226. A computer-aided design(CAD) database is selected that describes the regions of interest forthe object to be imaged in order to train the image recognition software10 at step 228 and the fiducials are verified at step 230. An image ofone or more blank assemblies (i.e., no components installed) iscollected at step 232, an image of one or more assembled assemblies iscollected at step 234, and the image data from the blank and assembledimages are verified at step 236. Data collection is complete when atleast one blank and one assembled PWA have been processed. If the datacollection is not complete, more images are collected at steps 232 and234. If the data collection is complete, the process moves to step 240to specify which parts on the PWA have polarity. The image recognitionsoftware now starts the new knowledge base creation at step 242. At step252 the image data is preprocessed, then features are generated for eachregion of interest for the first blank assembly at step 256. At step258, the presence/absence features across all blank and assembledassemblies previously imaged are scored, then the presence/absencefeatures are pruned at step 260. At step 260, the presence absencefeatures are pruned to provide the “optimal” features. Polarity featuresare then generated for each polarity region of interest from the firstassembled assembly at step 262, then the wrong polarity images areconstructed for each polarity region of interest at step 264. Thepolarity features are then scored across all assembled assemblies (bothcorrect and constructed wrong polarity images) for each polarity regionof interest at step 266. At step 268, these polarity features are prunedto provide the “best” polarity features. At this point, the imagerecognition software has generated the best (i.e., pruned) features forboth presence/absence and polarity from which to make thepresence/absence and polarity decision confidence analyses. At step 270,multiple assemblies are imaged to perform incremental training andrelative confidence window creation. Based on these previous steps,inspection criteria can be set at step 280.

[0066] Many of the steps described in FIGS. 1-3 will be more fullydescribed herein. Furthermore, the implementations of FIGS. 1-3described herein are not intended to limit the scope of the presentinvention. For example, in addition to populated printed wiring boards,the present invention is applicable to analysis of bare printed wiringboards, semiconductor packages (e.g., PPGAS, PBGAS, C4 packages, or TABtape) and other types of objects. Also, in contrast with the describedimplementation,

[0067] the imaging system can be fixed while the object to be analyzedis moved. This approach would allow the imaging system to remain morestable during scanning which would allow more precise motion for ultrahigh resolution images (e.g., ˜3 μm pixels vs. 30 μm pixels), but wouldlikely require a larger platform with a wider range of movement.

[0068]FIG. 4 shows a typical raw object image 12 taken by a camerahaving a number of regions of interest 14 (ROI). For the particularapplication of visual inspection of a PWA, the image 12 is the image ofa PWA and the ROIs 14 subimages 14 that include a component within theROI 14. For the specific application of determining the presence/absenceof a component, the regions of interest are preferably chosen to includediscreet components. The definition of the ROIs to include discreetcomponents can be initially provided to the dynamic image recognitionsoftware programming 10 of the present invention in a computer-aideddesign (or CAD) data file, where the CAD data file contains a computergenerated version of the location and orientation of the ROIs on theobject (i.e., the components on the PWA). Each ROI 14 has a horizontaland vertical upper position (x_(u), y_(u)) and a horizontal and verticallower position (x_(l), y_(l)). The ROIs 14 are subimages that are sentto processors to parallelize each image 12 down to the component part.

[0069]FIG. 5 shows a graphical representation of time versus accumulatedcharge for an image 12 taken to illustrate typical gain and offsetcorrection for an image 12 that can be performed using a visualinspection system of the present invention. The longer light of a givenand fixed intensity is provided to an object, the more charge isintegrated onto a pixel inside the camera. Pixel intensity is shown forthree pixels (P₁, P₂, and P₃) of non-equal intensity. Pixel intensity istypically linear over time (i.e., as time increases, the chargeincreases linearly). A potential problem arises because each pixel is adifferent semiconductor having a different gain and offset. However,since each is typically linear in nature, a prototypical line P_(T) canbe defined or chosen and secondary gain and offset can be calculated sothat every pixel maps to the prototypical line P_(T). In other words,even though P₁, P₂, and P₃ are not equal to start with, after applyingthe appropriate a and b coefficients, P₁′, P₂′, and P₃′ are all equal toP_(T). Thus, the differences between the lines normalize out to provideprime (or integrated) lines that are equivalent to P_(T). After the gainand offset correction has been applied, every pixel will look like theprototypical pixel (at P_(T))so that when light is illuminated for aparticular time (t), the intensity value (Q) will be the same at everypixel. This is important to reduce the irregularities between pixels.For example, suppose there are 255 gray levels, differences of five toeight or more gray levels can exist between adjacent pixels, which canbe significant noise. This noise can be eliminated for every pixelgenerated from the camera (through the appropriate gain and offsetcorrection) so that within a defined gray level range, all the pixelswill have the same value for any unique time interval. Thispre-processing can be built into the camera used to take the image.

[0070]FIG. 6 shows an graphical representation of a gamma correction orcontrast enhancement performed using the inspection system of thepresent invention. Specifically, the present invention can perform a lowlight level contrast enhancement at the expense of items with brighterlight levels. Typically, the better image content for images of PWAs formaking component level determinations is contained in the lower lightlevels of the PWAs. The purpose of the gamma correction is to enhancelow light levels. Therefore, in the darker areas from zero to apre-determined level, a steep gain is factored, while after thepredetermined level a more shallow gain is factored. The gammacorrection employed by the present invention can be a continuousfunction defined by:

y=255*[x/255]^(1/g)  (1)

[0071] where typical values include x=[0,255], y=[0,255] and in oneembodiment gamma or g=2 (note that for a gamma=1, the above function hasno effect). Gamma values in the range of two to three will appropriatelyenhance the low light level areas. To illustrate, at point A on thegraph of FIG. 6, the light intensity input (P_(IN)) is 100 (on a 0 to255 gray level scale), while the light output (after applying the gammacorrection function is 200 (P_(OUT)). An alternative to the functiondescribed above would be a piecewise or superposition linear function,rather than the exponential function described in FIG. 6. In atwo-segment, piecewise linear function, the first linear function can bechanged without affecting the second linear function.

[0072]FIG. 7 shows an exemplary raw eight bit gray level image 12 thatis ten by ten pixels. FIG. 7 will be further manipulated as shown in thefollowing figures. The raw pixel gray level image 12 will also bereferred to as the “mag0”, or zero order magnitude space, and each pixelwill be referred to with a “P (i,j)” where i and j represent a locationon the image defined as shown in FIG. 7 (i the vertical and j thehorizontal position beginning with a 0,0 position at the upper left handcorner). As a ten by ten pixel image, image 12 contains one hundredpixel values 18. Each pixel value 18 ranges between zero and 255, withzero representing the darkest value, or black, and 255 represents thelightest value, or white. For example, pixel P(0,0) has a gray scalevalue of 40. The image recognition software 10 of the present inventionwill manipulate the pixel values 18 to make the determinations of whichROIs contain present components and whether the components in the ROIhave the proper polarity.

[0073]FIGS. 8 and 9 show a gray scale reduction methodology and resultfor the image 12 of FIG. 7 using an exemplary reduction using a 256 to a4 gray scale transform 19 (i.e., from 0-255 to 0-3). Note that thereduction transform can be, and is in alternative embodiments, a highernumber (e.g., a reduction from 0,255 to 0,7). In a preferred embodiment,the gray scale reduction is from 256 gray levels to 12 codes. FIGS. 8and 9 shows a reduction from 256 gray levels to 4 codes to simplify thealgorithms for the purposes of illustration. In FIGS. 8 and 9, grayscales from 0-55 are given a code value of 0, gray scales from 56-130are given a code value 1, gray scales from 131-195 are given a codevalue 2, and from 196 to 255 are given a code value 3. According toreduction map 17, the reduction map 17 is used to cluster-the pixels.

[0074]FIG. 8 also illustrates the overlapping of certain pixel valueswithin certain ranges when scoring the pixels. Reduction map 15 is usedto score the pixels from an imaged object. Thus, as a pixel value nearsa change over code point (e.g., from a 0 to a 1 value), the imagerecognition software programming 10 of the present invention can performa ramping to give the pixel a relative code value. For example, anypixels with gray scale values between 50 and 60 in the ramp of FIG. 8will have a partial zero code value and a partial 1 code value definedby the ramp. As shown in FIG. 8, the ramp is from zero to five across aten pixel horizontal range. Thus, any pixels having gray scales betweenzero and fifty (and 60-125, 135-190, and 200-255) will fall on the “5”value, while pixels between 50 and 60 will have components of both azero code value and a one code value. For example, the point labeled Bis a 52 gray level raw image value. This translates to 80% code zeroreduced gray scale value and a 20% code one reduced gray scale value.The ramp down allows all. pixels to be represented by a reduced grayscale code value. The stepped reduction map 17 is used for clusteringbecause, for a cluster, a pixel must be in one cluster or another. Thus,there are distinct boundaries between groups of pixels. In contrast, theramped reduction map 15 is used for scoring to allow for a gradual classchange, for a more graceful degradation or transition between groups.

[0075] The result of performing the FIG. 8 methodology on the raw pixelimage 12 of FIG. 7 is shown in FIG. 9. FIG. 9 shows a 256>4 gray scalereduction image 20 for the image 12 of FIG. 7 using the 256 to Nreduction transform described by FIG. 8. The gray scale reduction image20 of FIG. 9 is also referred to as the “reduced mag0 space”, or thereduced zero order magnitude space 20. To illustrate, the reduced P(0,0) value of FIG. 9 is a “0” according to the grayscale reductiontransform 19 because the P(0,0) value of FIG. 7 is “40” which is between0 and 55. The remaining reduced P(i,j) values of FIG. 9 are determinedsimilarly. The raw image 12 has now been reduced to reduced zeromagnitude image 20 so that clustering can be performed as will bedescribed more fully. The image recognition software 10 performs ahistogram of the reduced zero order magnitude space to determine thenumber of zero order reduced magnitude color code classes required inorder to produce the zero order reduction map. The image recognitionsoftware program 10 contains the gray-scale or color reductionmethodology or algorithm described in FIG. 8. and creates the reducedmag0 space 20 by running the color reduction algorithm on the raw image12 of FIG. 9.

[0076]FIG. 10 shows both first order magnitude derivative image 22 andfirst order magnitude reduced image 30 (circled values) (referred toherein as the “mag1” or “first order magnitude space” and the “reducedmag1” or “reduced first order magnitude space”, respectively) of the rawgray scale image 12 of FIG. 7. FIG. 10 is derived from FIG. 7 usingimage recognition software program 10 as follows. The first ordermagnitude reduction values 21 (or P′(i,j)) at each point of the firstorder magnitude space 22 of FIG. 10 are determined as the maximumpositive difference between the raw pixel gray level value at that pointin FIG. 7 and each of the nine immediately adjacent pixel gray levelvalues of FIG. 7. The collection of these P′(i,j) 21 values representsthe first order magnitude space 22. For example, the first ordermagnitude value 21 for the P′(0,0) point (upper left hand corner of thefirst order magnitude space 22) is “1” because the gray level value forP(0,0) of FIG. 7 is 40 and the maximum positive difference betweenP(0,0) of FIG. 7 and each of the gray level values 18 surrounding P(0,0)is the difference between P(0,0) and P(1,0) (or 40−39=1). To furtherillustrate, P′(0,6)=130 for FIG. 10 because in FIG. 7, P(0,6)=175 andthe smallest of its eight surrounding pixels in FIG. 7 is P(0,5)=45. Ifall of the adjacent pixels have higher gray level values 18 in FIG. 7,the corresponding P′ point in FIG. 10 is assigned a first ordermagnitude value of “0” (see P′(4,9)). The first order magnitude values21 can be determined according to the formula:

P′(i,j)=MAX {P _(i,j) −P _(k,l)}  (2)

[0077] where k=(i, i+1, i−1) and l=(j, j+1, j−1). It should beunderstood that the second order magnitude values could also bedetermined in the converse (use the lowest differential). The firstorder magnitude space 22 can be similarly determined from any raw pixelgray level image 12.

[0078] The second step in FIG. 10 is to color reduce the first ordermagnitude space 22 to obtain the reduced first order magnitude space 30,which is illustrated by the circled numbers 23 in FIG. 10. The imagerecognition software program 10 again initiates the color reductionsubroutine to produce the reduce magl space 30 of FIG. 10 according to afirst order reduction map. On a raw gray level value scale from 0 to255, the magnitude reduction values 21 can also range from 0 to 255. Forthe example of FIG. 10, a first order reduction map 25 is used wherefirst order magnitude values of 0-45 are given a first order reducedmagnitude color code of 0, first order magnitude values of 46-137 aregiven a first order reduced magnitude color code of 1, and first ordermagnitude values of 138-255 are given first order reduced magnitudecolor code of 2. The image recognition software 10 performs a histogramof the first order magnitude space to determine the break points of thefirst order reduced magnitude color codes. The image recognitionsoftware 10 will limit the number of first order reduced magnitude colorcodes in order to reduce complexity while maintaining enough color codeclasses to provide a distinction between groups of magnitude reductionvalues. An example of this is provided in Color Image Quantization forFrame Buffer Display; COMPUTER GRAPHICS, Vol. 16, No. 3, pp. 297-305,July 1982.

[0079]FIG. 11 shows a first order direction derivative image 40,referred to herein as the “dir1” or the “first order direction space,”of the raw gray scale image 12 of FIG. 7. FIG. 11, like FIG. 10, is alsoderived from FIG. 7 using the image recognition software 10. The firstorder direction code values 28 for any particular location in the firstorder direction space 40 is determined based on the direction code map26. As shown in FIG. 11, direction code map 26 has nine code values from0 to 8 to indicate the direction from the P(i,j) location on FIG. 7 tothe lowest, immediately adjacent P (i±1, j±1) value. For example, if thelowest value of the pixels surrounding a particular pixel in FIG. 7 islocated directly above that particular pixel, the direction code will bea “2” according to direction code map 26. It should be understood thatthe numbering of the direction code map 26 can vary and the particularordering of the numbers does not matter, though in the preferredembodiment, the direction code map 26 will contain nine distinct numberswhich are preferably integers to reduce computing complexity.

[0080] The image recognition software 10 determines the first orderdirection code values 28 (FIRST DIRECTION CODE (i,j)) at each point onthe first order direction space 40 by calculating the direction fromthat point on FIG. 7 to the lowest value raw pixel gray level value 18of its eight immediately adjacent raw pixel gray level values 18 basedon the raw pixel gray level values from FIG. 7. In other words, thedirection code will lie at the same position that was used to determinethe first order P′(i,j) 21 values of FIG. 10. For example, FIRSTDIRECTION CODE (0,0) (i.e., first order direction code at point 0,0) isdetermined by looking at P(0,0) of FIG. 7 and determining which of itssurrounding raw image pixels has the lowest gray level value (just aswas done to determine the magnitude space of FIG. 10). Since the lowestgray level value surrounding P(0,0) occurs at P(1,0) which is directlybelow P(0,0), the FIRST DIRECTION CODE (0,0) is “7” according to thedirection code map 26. To further illustrate, FIRST DIRECTION CODE(0,6)=4 due to the fact that the lowest raw pixel gray level 18surrounding P(0,6) is located at P(0,5) which is in direction code “4”(or directly adjacent to the left) according to direction code map 26.If none of the pixels (i.e., P(i,j) values) surrounding the pixel ofinterest in FIG. 7 have a lower gray level value than the pixel ofinterest, the first order direction code 28 is entered as a “0” whichsignifies that no surrounding pixel had a lower level value (forexample, FIRST DIRECTION CODE (4,9) is a “0” because none of pixelsimmediately adjacent to P (4,9) have lower gray level values thanP(4,9)). Furthermore, if two or more immediately adjacent pixels have anequal, yet lowest value, the first order direction code 28 will be thelowest available direction code based on the direction code map 26 (forexample, FIRST DIRECTION CODE (1,1) is a “4” rather than a “6”, eventhough both P(1,0) and P(2,0) have a equal lowest P value of “39”,because 4 is less than 6). It should be understood that the rule ofchoosing the lower direction code value for equally low P values isarbitrary and the highest direction code value (or even an arbitrarycode value) could also have been chosen. While either mode is equallyacceptable, a consistent selection throughout is preferable. All of theFIRST DIRECTION CODEs of the dir1 or first order direction space 40 aredetermined similarly, as illustrated in FIG. 11.

[0081]FIGS. 12 and 13 are derived from the FIG. 10 first order magnitudespace 22 in the same manner that FIGS. 10 and 11 were derived from thezero order magnitude space 12 of FIG. 7 using image recognition software10. FIG. 12 shows both the second order magnitude derivative image 32and second order magnitude reduced image 50 (circled values) (referredto herein as the “mag2” or “second order magnitude space”, and the“reduced mag2” or “reduced second order magnitude space”, respectively)of the first order magnitude space 22 of FIG. 10. The second ordermagnitude reduction values 34 (or P″(i,j)) at each point of the secondorder magnitude space 32 of FIG. 10 are determined as the maximumpositive difference between the first order magnitude values 21 at thatpoint in FIG. 10 and each of its eight immediately adjacent first ordermagnitude values 21. The collection of these P″(i,j) 34 valuesrepresents the second order magnitude space 32. As an example, thesecond order magnitude value 34 for the P″(0,0) point (upper left handcorner of the second order magnitude space 32) is “1” based on 1−0=1because the value for P′(0,0) of FIG. 10 is “1” and the lowest P′ aroundP′(0,0) is a “0” value at P′(1,0). To further illustrate, P″(9,9)=26because in FIG. 10, P′(9,9)=27 and the smallest of its eight surroundingP′ values in FIG. 10 is P′(8,9)=1. Once again, if all of the adjacent P′values in FIG. 10 are equal to or higher than the P′ of interest, the P′value in FIG. 12 is assigned a second order magnitude value of “0” (seeP′(4,9)). The second order magnitude values 34 can be determinedaccording to the formula:

P″ (i,j)=MAX (P′ _(i,j) −P′ _(k,l))  (3)

[0082] where k=(i, i+1, i−1) and l=(j, j+1, j−1). It should beunderstood that the second order magnitude values can be determined inthe converse (use the lowest differential). The second order magnitudespace 32 can be similarly determined from any first order magnitudespace 22.

[0083] The reduced second order magnitude space (or “reduced mag2”),represented by the circled numerals in FIG. 12, is created by colorreducing the second order magnitude space 32. For FIG. 12, a secondorder reduction map 38 is used such that second order magnitude valuesof 0-43 are given a second order reduced magnitude color code of 0,second order magnitude values of 44-136 are given a second order reducedmagnitude color code of 1, and second order magnitude values of 137-255are given a second order reduced magnitude color code of 2. In order toobtain the second order reduction map 38, the image recognition software10 creates a histogram of the second order magnitude space 32 todetermine the number of break points for the second order reducedmagnitude color codes, similarly to that described in creating the firstorder reduction map 25.

[0084]FIG. 13 shows a second order direction derivative image 60,referred to herein as the “dir2” or the “second order direction space,”of the first order magnitude space 32 of FIG. 10. The second orderdirection code values 42 for any particular location in the second orderdirection space 60 is once again determined based on the direction codemap 26. The second order direction code values 42 (SECOND DIRECTIONCODE(i,j)) at each point on the second order direction space 60 aredetermined as the direction from that corresponding (i,j) position onFIG. 10 to the lowest value first order magnitude value 21 (or P′) ofits eight immediately adjacent P′ values 21. In other words, thedirection code will lie at the same position that was used to determinethe P″(i,j) of FIG. 12. For example, SECOND DIRECTION CODE (0,0) (i.e.,second order direction code at point (0,0) of FIG. 13 is determined bylooking at P′(0,0) of FIG. 10 and determining which of its surroundingraw image pixels has the lowest gray level value (just as was done todetermine the second order magnitude space of FIG. 12). Since the lowestP′ value surrounding P′ (0,0) occurs at P′ (1,0) which is directly belowP′ (0,0), the SECOND DIRECTION CODE (0,0) is “7” according to thedirection code map 26. To further illustrate, P″ (6,3)=5 due to the factthat the lowest P′ value 2l surrounding P′ (6,3) in FIG. 10 is locatedat P′ (6,4) which is in direction code “5” (or directly adjacent to theright) according to direction code map 26. As in FIG. 11, if none of thesurrounding P′ values of FIG. 10 have a lower P′ value than the P′ ofinterest, the second order direction code 42 is entered as a “0” in FIG.13 (see P″(4,9) of FIG. 13). Likewise, if two surrounding P′ values arelowest and equal, the second order direction code 42 chosen will be thelower direction code from direction code map 26 (see P″(1,1) of FIG.13). All of the SECOND DIRECTION CODEs (i,j) of the dir2 or second orderdirection space 60 are determined similarly, as illustrated at FIG. 13.

[0085] It should be understood that higher order derivatives of FIG. 7(beyond the second order magnitude and direction derivatives) could bedetermined in a similar manner using the methodology described above andvariations of that methodology. While some additional information can beobtained from the higher order derivatives, the present invention can bepracticed successfully by using the second order derivatives described,and the additional complexity of accumulating and processing the higherorder derivatives has not been found necessary to date.

[0086] The additional functions of the image recognition softwareprogram 10 of the present invention will be described using the fivederived spaces described. The result of the manipulations of the rawpixel image 12 of FIG. 7 by the image recognition software 10 is toproduce five independent spaces from the initial image 12: (1) thereduced zero order magnitude space 20 shown in FIG. 9 (reduced mag0);(2) the reduced first order magnitude space 30 shown in FIG. 10 (reducedmag1); (3) the first-order direction space 40 shown in FIG. 11 (dir1);(4) the reduced second order magnitude space 50 shown in FIG. 12(reduced mag2); and (5) the second order direction space 60 shown inFIG. 13 (dir2). Image recognition software programming 10 can performclustering and cluster reduction on these five spaces to generate“features” within the regions of interest in each space in order todetermine the presence/absence and polarity of the ROIs in the raw image12. The manner in which clustering and cluster reduction is performed onthese five spaces is described in FIGS. 14-21.

[0087] FIGS. 14-21 illustrate the clustering and cluster reductionprocess for the reduced zero order magnitude space 20 of FIG. 9 usingclustering and cluster reduction rules contained within imagerecognition program 10. The clustering can be performed. similarly foreach of the other four spaces. It should be understood that otherclustering rules could be used for all five spaces, or even thatdifferent clustering rules could be used on each of the five spaces.

[0088]FIG. 14 shows an initial clustering result 44 created by imagerecognition program 10 by performing clustering on the reduced mag0space 20 of FIG. 9 to create six bounding boxes 70. In the embodimentshown in FIG. 14, the initial bounding boxes 70 are created according tothe following general rules:

[0089] 1) at a defined starting point on FIG. 9, begin passing a threeby three filter over the entire region of interest (ROI) where a threeby three filter is the process of examining the eight closest neighborsto each pixel (this can be done according to a predetermined strategy;for example, a raster scanning methodology that begins at the upper leftpixel in the image and travels horizontally until all pixels in thefirst row have been examined and then starts at the second row of pixelsat the left-most pixel, and so on until all pixels have been examined);

[0090] 2) filter each pixel according to the following rules:

[0091] i) if pixel (i,j) has the same code as one or more of the eightneighboring pixels to pixel (i,j), assign pixel (i,j) the same clusternumber as the matching neighboring pixel(s), [where the neighboringpixels for pixel (i,j)=at least pixels {(i−1,j−1), (i−1,j), (i−1, j+1),and (i,j−1)} (these four neighbors are used out of the eightneighborhood for a raster scanning methodology for simplicity)];

[0092] ii) if multiple neighboring pixels have matching codes and thereis more than one cluster number assigned to these multiple matchingneighboring pixels, assign pixel (i,j) the codes of all matchingneighbors;

[0093] iii) else, assign pixel (i,j) a unique cluster number;

[0094] 3) for all pixels with multiple cluster numbers, choose one ofthe cluster numbers to define these pixels;

[0095] 4) pass over the entire ROI a second time to convert all clusternumbers using the reduction map to reduce the space; and

[0096] 5) define bounding boxes for each cluster that contain all of thepoints in the cluster.

[0097] These rules will be further elaborated upon in the description ofFIG. 14. It should be understood that additional clustering mechanismscan be added to these within image recognition program 10 toadditionally cluster codes. Furthermore, initiating clustering atparticular defined points, such as a corner of the image, can reduce thecomplexity of the clustering algorithm as illustrated below and in FIG.14.

[0098]FIG. 14 will illustrate the clustering of image recognitionsoftware 10 for the reduced mag0 space 20 of FIG. 9. The initial cluster#1 will begin at reduced P(0,0) of FIG. 9 which has a value of “0” andwill continue both horizontally and vertically until a differentreduction code is encountered to include all the “0” reduction codes.Thus, for cluster #1, the “0” reduction codes go horizontally untilreduced P(0,6) which has a “2” code (thus cluster #1 will includereduced P(0,0) to reduced P(0,5) horizontally) and vertically down untilreduced P(5,0) which has a “3” code (thus cluster number 1 will includereduced P(0,0) to reduced P(4,0) vertically). The same algorithm is nowperformed at reduced P(4,0) and reduced P(0,5) to determine if eitherhorizontally or vertically, respectively, the “0” codes continue outsidethe area already bounded by reduced P(0,0), reduced P(0,5) and reducedP(4,0). Since horizontally from reduced P(4,0) the “0” codes only extendone more place (to reduced P(4,1) and since vertically from reducedP(0,5) the “0” codes do not extend at all, the bounding box remains therectangle bounded by reduced P(0,0), reduced P(0,5), reduced P(4,0), andreduced (4,5). In this way, all adjacent code “0” values get clusteredin cluster number 1 (along with some non-code “0” values).

[0099] At this point, the process is repeated for the two initiallydiscovered new codes at P(0,6) which is a code “2” and P(5,0) which is acode “3”. Cluster number 2 includes the code “2” values from reducedP(0,6) horizontally to reduced P(0,8) and down from reduced P(0,8) toreduce P(8,8) and is determined as described for cluster number 1.Cluster number 5 is formed starting at reduced P(5,0) and travelshorizontally to reduced P(5,1) and vertically down to reduced P(8,0).From P(8,0) the box expands horizontally to the right to include throughreduced P(8,7). From reduced P(8,7) the bounding box expands upvertically to include reduced P(3,7). Thus, bounding box 70 for clusternumber 5 is defined at its corners by reduced P(3,0), reduced P(8,0),reduced P(8,7), and reduced P(3,7). Bounding boxes 70 for cluster number3 and number 6 are formed similarly from starting points lying outsideof cluster number 2 and number 5, respectively. At this point, everycode of FIG. 9 is included in a bounding box 70.

[0100] Table 1 shows the results of the clustering performed in FIG. 14and some additional calculations performed by the image recognitionsoftware 10. As shown in TABLE 1, feature number 1 is a bounding box 70with a code “0” that is generated from cluster number 1 data (the codesused to generate the bounding box) that includes fourteen code “0”pixels and a bounding box area of thirty (i.e., 30 total pixels). Once abounding box is placed around a cluster of pixels, that bounded clusterof pixels is a “feature.” The image recognition software 10 calculates afeature number 1 raw density of code “0” pixels relative to the totalnumber of pixels in the bounding box as 47% (i.e., 47% of the pixels infeature 1 are code “0” pixels); and then calculates a reduction rawdensity ratio, which is the reduced number of code “0” pixels divided bythe initial number of code “0” pixels. The purpose of the reductionratio is to track how much of the feature is eliminated due to shrinkingrules as will be further described below. Similarly, feature number 5 isa code “3” feature having thirty-two code “5” pixels, forty-eight totalpixels in the bounding box, and a raw density of 67%. The imagerecognition software 10 performs these calculations for all featuresformed (as shown in Table 1). TABLE 1 FEATURE NUMBER NUMBER OF PIXELS OFCODE TYPE (# PIXELS) BOUNDING BOX AREA (BB AREA) $\begin{matrix}{{RAW}\quad {DENSITY}} \\\left\{ \frac{\# \quad {PIXELS}}{{BB}\quad {AREA}} \right\}\end{matrix}\quad$

$\begin{matrix}{REDUCTION} \\{RATIO} \\\left\{ \frac{\# \quad {PIXELS}}{\# \quad {PIXELS}} \right\}\end{matrix}\quad$

1 0 14 30 47% 2 2 11 27 41% 3 0 9 9 100%  9/9 100% 4 1 24 36 67% 5 3 3248 67% 6 1 10 10 100%  10/10 100%

[0101] The image recognition software 10 now performs an analysis on theraw density for each cluster to determine whether any of the featuresmeet a minimum raw density threshold. In one embodiment, if the rawdensity of a feature is less than 75%, then the image recognitionsoftware 10 will shrink or erode the bounding boxes 70 for that feature.Thus, for the clusters of FIG. 14 and Table 1, feature numbers 3 and 6have raw densities in excess of 75% and thus will not be furthermanipulated or shrunk. Each of features 1, 2, 4 and 5 do not meet theminimum density threshold and will be shrunk. The image recognitionsoftware 10 will shrink the bounding boxes 70 to remove the “weakest”edge so that the outermost edge containing the fewest number of codesfor that feature is eroded.

[0102] The image recognition software 10 can also perform anotheranalysis on each feature by calculating an “edge ratio” for each edge ofeach feature and comparing these edge ratios to a minimum edge ratiothreshold. The edge ratios for each feature is calculated by definingthe outer horizontal row(s) and/or vertical column(s) of the boundingboxes 70 and dividing the number of codes for that feature contained inthe edge by the total number of codes in that edge. In one embodiment,if any edge ratio is less than 25%, the image recognition software 10will shrink the bounding box 70 by eroding the edge having the minimumedge ratio. It should be understood that the erosion of bounding boxescould be based on 1) density, 2) edge ratios or 3) both.

[0103]FIG. 15 contains clustering result 46 after image recognitionsoftware 10 performs a first iteration shrinking of features 1, 2, 4 and5. In feature number 1, there are four edges that could potentially beremoved: Edge 72 defined as reduced P(0,0) to reduced P(0,5) thatcontains six values, Edge 74 from reduced P(0,0) to reduced P(4,0), Edge76 from reduced P(4,0) to reduced P(4,5), and Edge 78. Edges 72 and 74both contain all code “0” and therefore represent very strong edges thatwould not be eroded. Edge 76 has six values, two of which are code “0”for an edge ratio of 2/6 or 33%. Edge 78 has five values, only one ofwhich is a code “0” for an edge ratio of 1/5 or 20%. As the minimum edgeratio for feature number 1 occurs along edge 78, the image recognitionsoftware 10 shrinks bounding box 70 so that feature number 1 no longerincludes edge 78. Note that if two or more edges on a feature have thesame edge ratio, any one of the edges can be removed randomly or by somedefined choosing mechanism. After the erosion process, feature number 1is now bounded by reduced P(0,0), reduced P(4,0), reduced P(0,4), andreduced P(4,4), as shown in FIG. 15. Similar edge reductions to erodethe weakest edge are performed by the image recognition software 10 onfeatures 2, 4, and 5 as shown in FIG. 15.

[0104] The image recognition software 10 now performs additionalcalculations on the newly shrunken features 1, 2, 4 and 5 as shown inTable 2. TABLE 2 FEATURE NUMBER CODE REDUCED NUMBER OF PIXELS OF CODETYPE (R PIXELS) REDUCED BOUNDING PIXELS OF CODE TYPE (R PIXELS)$\begin{matrix}{FIRST} \\{REDUCTION} \\{DENSITY} \\\left\{ \frac{R\quad {PIXELS}}{{RBB}\quad {AREA}} \right\}\end{matrix}\quad$

$\begin{matrix}{FIRST} \\{REDUCTION} \\{RATIO} \\\left\{ \frac{R\quad {PIXELS}}{{RBB}\quad {AREA}} \right\}\end{matrix}\quad$

1 0 13 25 52% N/A 2 2 10 18 56% N/A 3 0 9 9 100%  (100%) 4 1 22 30 73%N/A 5 3 28 40 70% N/A 6 1 10 10 100%  (100%)

[0105] Feature number 1 of Table 2 is a code “0” cluster that nowcontains thirteen code “0” pixels (one code “0” being lost due to theedge reduction) and twenty-five total pixels. The first reductiondensity is calculated by dividing the remaining number of code “0”pixels in the reduced feature number 1 by the reduced bounding box areafor reduced feature number 1 (i.e., 13/25) to provide a first reductiondensity of 52%. A first reduction ratio can be calculated for featurenumber 1 by dividing the remaining number of code “0” pixels in thereduced bounding box (13) by the number of pixels in the originalfeature number 1 bounding box (14), for a first reduction ratio ofapproximately 93%. However, because the first reduction density forfeature number 1 remains below the density threshold of 75%, anadditional edge reduction must be performed on feature number 1.Therefore, the first reduction ratio need not be calculated because thereduction ratio is used after the minimum density threshold is met todetermine if too much of the initial feature has been eroded (more fullydescribed by FIGS. 16-18 and its accompanying text). As shown in FIG.15, none of clusters 1, 2, 4 or 5 met the density threshold of 75% afterthe first edge reduction, necessitating a second edge reduction by imagerecognition program 10 according to the same edge ratio rules previouslydescribed.

[0106]FIG. 16 shows the cluster result 48 after a second edge reductionhas been performed on features 1, 2, 4 and 5. New cluster number 1 shownin FIG. 16 has had edge 80 removed so that feature number 1 is nowbounded by reduced P(0,0), reduced P(4,0), reduced P(0,3), and reducedP(4,3). As can be seen, edge 80 had an edge ratio of 20%. Similar edgereductions to erode the weakest edge are performed by the imagerecognition software 10 on features 2, 4, and 5, as shown in FIG. 16.

[0107] The image recognition software 10 now performs additionalcalculations on the second iteration reduced features 1, 2, 4 and 5 asshown in Table 3 in a manner similar to those performed to obtain Table2.

[0108] Note that: the already calculated data for features 3 and 6 isincluded for reference. TABLE 3 FEATURE NUMBER CODE 2X REDUCED NUMBER OFPIXELS OF CODE TYPE (2R PIXELS) 2X REDUCED BOUNDING BOX AREA (2R BBAREA) $\begin{matrix}{SECOND} \\{REDUCTION} \\{DENSITY} \\\left\{ \frac{2R\quad {PIXELS}}{2R\quad {BB}\quad {AREA}} \right\}\end{matrix}\quad$

$\begin{matrix}{SECOND} \\{REDUCTION} \\{RATIO} \\\left\{ \frac{2R\quad {PIXELS}}{\# \quad {PIXELS}} \right\}\end{matrix}\quad$

1 0 12 20  60% 2 2 9 9 100%  9/11 = 82% 3 0 9 9 100% (100%) 4 1 20 24 83% 20/24 = 83% 5 3 24 32  75% 20/32 = 75% 6 1 10 10 100% (100%)

[0109] Table 3 shows feature number 1 as a code “0” cluster that nowcontains twelve code “0” pixels and twenty total pixels. The secondreduction density is calculated by dividing the remaining number of code“0” pixels in the second reduced feature number 1 by the second reducedbounding box area (12/20), for a resulting second reduction density of60%. Again, feature number 1 fails to meet the minimum density thresholdof 75%.

[0110] However, unlike feature number 1, features 2, 4, and 5 havesecond reduction densities of greater than 75% and no further edgereduction is required for density. Now the reduction ratio becomesimportant. The reduction ratio is a measure of how many of the codepixels were eliminated in order to meet the density threshold. If toomany of the feature code pixels were eliminated, another type ofclustering must be performed. In one embodiment, the reduction ratiomust exceed 75% after the density threshold has been met in order forthe clustering to be complete.

[0111] The reduction ratio number can be chosen empirically based onexperience of an operator, or can be chosen from typical values rangingfrom 50%-90%.

[0112] Using feature number 2 as an example, image reduction software 10calculates the reduction ratio as the, number of code “2” pixels in thesecond reduced feature number 2 bounding box divided by the number ofcode “2” pixels in the original feature number bounding box of FIG. 14.In this case, nine code “2” pixels remain in second reduced featurenumber 2 and eleven code “2” pixels existed in the original featurenumber 2, for a reduction ratio of 82%. Since 82% exceeds the reductionratio threshold of 75%, the second reduced feature number 2 isacceptable and requires no further manipulation or shrinking by imagerecognition program 10. Table 3 illustrates that the same is true forfeatures 4 and 5 because each now has both a density and reduction ratioequal to, or in excess of, 75%. Thus, after the second edge reduction,features 2-6 have been fixed (as shown in FIG. 16). However, anadditional edge reduction must be performed on feature number 1.

[0113]FIG. 17 shows the cluster result 52 after a third edge reductionhas been performed on feature number 1. New feature number 1 shown inFIG. 17 has had edge 82 removed so that feature number 1 is now boundedby reduced P(0,0), reduced P(4,0), reduced P(0,2), and reduced P(4,2).Image recognition software 10 now performs the density calculations onthird iteration reduced feature number 1 as shown in Table 4 (again, thepreviously determined data on features 2-6 is included for reference).TABLE 4 FEATURE NUMBER CODE 3X REDUCED NUMBER OF PIXELS OF CODE TYPE (3RPIXELS) 3X REDUCED BOUNDING BOX AREA (3R BB AREA) $\begin{matrix}{THIRD} \\{REDUCTION} \\{DENSITY} \\\left\{ \frac{R\quad {PIXELS}}{{RBB}\quad {AREA}} \right\}\end{matrix}\quad$

$\begin{matrix}{SECOND} \\{REDUCTION} \\{RATIO} \\\left\{ \frac{3R\quad {PIXELS}}{\# \quad {PIXELS}} \right\}\end{matrix}\quad$

1 0 11 15  73% 2 2 9 9 100% (82%) 3 0 9 9 100% (100%)  4 1 20 24  83%(83%) 5 3 24 30  75% (75%) 6 1 10 10 100% (100%) 

[0114] Table 4 shows that feature number 1 still fails to meet theminimum density threshold of 75%. Yet another edge reduction must beperformed on feature number 1.

[0115]FIG. 18 shows the cluster result 56 after a fourth edge reductionhas been performed on feature number 1. New feature number 1 shown inFIG. 18 has had edge 84 removed so that feature number 1 is now boundedby reduced P(0,0), reduced P(4,0), reduced P(0,1), and reduced P(4,1).Image recognition software 10 now performs the density calculations onthis four times reduced feature number 1 with the results tabulated inTable 5. TABLE 5 FEATURE NUMBER CODE 4X REDUCED NUMBER OF PIXELS OF CODETYPE (4R PIXELS) 4X REDUCED BOUNDING BOX AREA (4R BB AREA)$\begin{matrix}{FIRST} \\{REDUCTION} \\{DENSITY} \\\left\{ \frac{4R\quad {PIXELS}}{4R\quad {BB}\quad {AREA}} \right\}\end{matrix}\quad$

$\begin{matrix}{FIRST} \\{REDUCTION} \\{RATIO} \\\left\{ \frac{4R\quad {PIXELS}}{\# \quad {PIXELS}} \right\}\end{matrix}\quad$

1 0 10 10 100% 10/14 71% < 75% 2 2 9 9 100% (82%) 3 0 9 9 100% (100%)  41 16 18  83% (83%) 5 3 20 24  75% (75%) 6 1 10 10 100% (100%) 

[0116] Table 5 shows that cluster number 1 now meets the minimum densitythreshold of 75% because all ten pixels in feature number 1 are now code“0”. Image reduction software 10 now calculates the fourth reductionratio on feature number 1 by dividing the number of code “0” pixelsremaining in feature number 1 after the four edge reductions by thetotal number of code “0” pixels in the original feature number 1bounding box of FIG. 14. The fourth reduction ratio for feature number 1is 71% or (10/14). Since 71% does not exceed the reduction ratiothreshold of 75%, the fourth reduced feature number 1 is not acceptableand further manipulation by image recognition program 10 is required.Again, the purpose of the reduction ratio is to flag when too many ofthe original code pixels have been lost due to edge reduction.

[0117]FIG. 19 shows the clustering result 58 that includes theclustering results for features 2-6 and the original bounding box 86 forfeature number 1 (labeled 86). The image recognition software 10 canhandle the original bounding box 86 in different ways. In the embodimentshown in FIG. 19, the original bounding box 86 for feature number 1 isdivided along its longer axis at dividing boundary 88 as shown. Thisdividing boundary 88 can be at the center or some other defined pointalong the longer axis. This results in two new sub-features, featurenumber 1-1 and feature number 1-2. Image recognition software 10 willnow use the density thresholds, edge reduction rules and reduction ratiothresholds as previously described to reduce these new sub-clusters. Asshown in TABLE 6, neither feature 1-1 nor feature 1-2 meet the minimumdensity threshold. In an alternative embodiment, if an original boundingbox fails to meet the reduction ratio threshold, the image recognitionsoftware 10 analyzes the size of the original bounding box and if thesize is less than a minimum size threshold (for example, less than 25pixels), the image recognition software 10 can simply accept theoriginal feature. TABLE 6 FEATURE NUMBER CODE NUMBER OF PIXELS BOUNDINGBOX AREA $\begin{matrix}{{RAW}\quad {SPLIT}} \\{DENSITY} \\\left\{ \frac{\quad {PIXELS}}{{BB}\quad {AREA}} \right\}\end{matrix}\quad$

REDUCTION RATIO 1-2 0 11 15 73% 1-2 0 3 15 20% 2 2 9 9 100%  (82%) 3 0 99 100%  (100%)  4 1 20 24 83% (83%) 5 3 24 12 75% (75%) 6 1 10 10 100% (100%) 

[0118]FIG. 20 shows clustering result 62 after a first edge reductionhas been performed on feature 1-1 and after several edge reductions havebeen performed on feature 1-2 by image recognition software 10. Thecalculations performed by image recognition software 10 on features 1-1and 1-2 are contained in TABLE 7. Both resulting “0” code features nowhave a density and reduction ratio in excess of 75%. Note that moreelaborate splitting routines may be included in image recognitionsoftware 10 so that reduced P(0,2), shown as 0*, gets included infeature 1-2. TABLE 7 FEATURE NUMBER OF BOUNDING REDUCTION REDUCTIONNUMBER CODE PIXELS BOX AREA DENSITY RATIO 1-1 0 10 10 100% 10/11 91% 1-20  3  3 100% 3/3 100% 2 2  9  9 100%  (82%) 3 0  9  9 100% (100%) 4 1 2024  83%  (83%) 5 3 24 32  75%  (75%) 6 1 10 10 100% (100%)

[0119]FIG. 21 shows the final clustering result 64 that includes thebounding boxes 90 created according to the clustering rules in thedescribed embodiment of image recognition software 10 on the reducedimage 20 of FIG. 9. Table 8 shows a summary of the final tabulated andcalculated values related with each of the created features of FIG. 21.TABLE 8 FINAL FINAL FINAL FINAL FEATURE NUMBER OF BOUNDING REDUCTIONREDUCTION NUMBER CODE PIXELS BOX AREA DENSITY RATIO 1-1 0 10 10 100% 91%1-2 0  3  3 100% 100%  2 2  9  9 100% 82% 3 0  9  9 100% 100%  4 1 20 24 83% 83% 5 3 24 32  75% 75% 6 1 10 10 100% 100% 

[0120] For the example of FIG. 21, seven features 90 were generated:feature 1-1, feature 1-2, feature 2, feature 3, feature 4, feature 5,and feature 6. The image recognition software 10 can similarly create aset of features for each of the other four spaces (reduced mag1, dir2,reduced mag2 and dir2). Features 90 (or feature boxes 90 as shown inFIG. 22) for each of the five spaces will be further manipulated byimage recognition software 10 to make presence/absence and polaritydeterminations.

[0121] The features 90 of the five spaces can now be given a “score” bythe image recognition software 10. Scoring is the process of providing arelative count of the number of pixels with the specified code for thatfeature that are actually within the feature box. For example, thefeature box 90 created from cluster number 1 of FIG. 9 is a code “0”,and each code “0” pixel in FIG. 9 within feature box 90 created fromcluster 1 will get counted.

[0122] The feature scoring function performed by the image recognitionsoftware 10 of the present invention for the direction spaces (i.e., thefirst order direction space 40 (dir1) and the second order directionspace 60 (dir2)) is done by placing each feature 90 created duringclustering for these two spaces onto the appropriate direction spacewhere that feature is expected on the direction space and simplycounting the number of pixels with the specified code. The“presence/absence” features are generated from the initial “blank”training PWA (i.e., no-components assembled or assembled on the PWA),whereas the “polarity” features are generated from the initial“assembled” or assembled PWA. Once the features have been generated, theimage recognition software of the present invention scores the imagesused to generate the features and any other training example PWAsimaged. For example, if an operator runs two blank PWAs and sixassembled PWAs through an imaging system containing theimage-recognition software 10, the image recognition software 10 will,for presence absence: (1) generate the presence/absence features fromthe first blank PWA; (2) score those generated features on the firstblank PWA; (3) score those same generated features on the second blankPWA by laying the features over the image of the second blank PWA; (4)score the same presence/absence features generated from the first blankPWA on the six assembled PWAs. For polarity, the image recognitionsoftware will: (1) generate the polarity features from the firstassembled PWA; (2) rotate the feature images to generate “wrong”polarity features (in the preferred embodiment, the window imaged abouta component is relatively narrow to minimize the impact from the boardfeatures which are not rotated); (3) score the polarity features on alleight PWAs. Thus, for each training example PWA, the images of those PWAare converted into the various spaces and then lay the features(generated in each of the five spaces from the first assembled or blankPWA for polarity and presence/absence respectively) over the five spacesand score the features based on pixel gray levels.

[0123] The image recognition software 10 scores each feature in thedirection spaces according to the formula:

SCORE (K)=ΣP(i,j) for P(i,j)εBB_(K)  (4)

[0124] where P(i,j)=1, if code (P)=code (K) 0, if otherwise;

[0125] and where K is a feature number, BB_(K) is a bounding boxbounding feature K, and P(i,j) are the pixels within feature K. Thescore for any feature box 90 in a direction space will be precisely thenumber of direction codes on the image that match the direction code ofthe feature box 90 (as determined during clustering).

[0126] Note that the image recognition software 10 may include theability to move the score window±x,y, where x represents a number ofpixels in the horizontal direction and y represents a number of pixelsin the vertical direction, to account for lack of precise mechanicalrepeatability in the imaging system controlling the imaging of the PWA.In other words, the mechanical system that places the PWA in positionfor imaging may lack the precision to place each PWA in exactly the sameposition every time, thus causing movement in the x and y directionsbetween images of the same region of interest or feature. Thus, aparticular pixel (i,j) for a first PWA may not be precisely the samepixel (i,j) on a second imaged PWA. To account for this, the imagerecognition software 10 will score features within a scoring window of±x,y pixels. The size of this scoring window depends entirely upon theprecision of the mechanical repeatability of the imaging system. In oneembodiment, the hardware repeatability was ±1 pixel in the x direction,and ±4 pixels in the y direction, so the scoring window in the imagerecognition software 10 was ±2 pixel in the x direction, and ±5 pixelsin the y direction (which provides a safety margin of 1 pixel in eachdirection). For an imaging system that repeats to approximately 4micrometers (i.e., repeatability to a fraction of a pixel), the imagerecognition program 10 scoring window can be ±1 pixel in both the x andy directions; or can require no movement at all (i.e., IO).

[0127] For gray level features (i.e., for reduced mag0, reduced mag1,and reduced mag2 spaces), the image recognition program 10 will scorethe feature 90 using the same methodology as for direction spaces,except that some pixels will not add a full integer value (for the rampof FIG. 8, that full integer value is 5) depending on where the pixelsfall on the ramp of FIG. 8. For example, for a pixel P(i,j) from FIG. 7,if the raw pixel value is between 0-50, 60-125, 135-190, and 200-255,and if the code from the feature box 90 matches the code for the reducedmagnitude space, the score will be increased by five. If the raw pixelvalue is between 50-60, 125-135, or 190-200, and the code from thefeature box 90 matches the code for the reduced magnitude space, thescore will be increased by a fraction of five, where the fraction isbased on the raw pixels fraction above zero on the ramp. Similar to thedirection scoring, if the code from the feature box 90 does not matchthe code for the reduced magnitude space, the score will be not beincreased at all (i.e., add zero). Note that the ramp of zero to five(cf. a ramp of zero to one) was chosen for the processing compatibilitywith the accelerators in the preferred embodiment of the computer system90 (Texas Instruments TMS 320C80 DSPs). Note that each feature score isbased on the pixel gray levels within the feature. For example, if afeature code is “0,” pixels with gray levels from 0 to 59 will add tothe “0” score, while all other pixels will not.

[0128] When an assembled PWA (or an object containing components withinthe regions of interest) is imaged, the feature scores will move towardsmissing as the bare board is exposed, but will gravitate towards presentwhen the component covers the board. In other words, when a feature isfilled up with proper codes, the scores will be higher, and this impliesa part is missing. The converse is true (i.e., when the scores for thefeatures are reduced the likelihood the part is present increases).Thus, the feature scores generated by the image recognition software 10will represent the score for a feature when it is present and a scorefor when the feature is absent. Similarly, a feature score will existfor right polarity and wrong polarity of the component. Note that imagerecognition software 10 will associate each region of interest with aset of features 90 and each feature 90 with a particular space.

[0129]FIG. 23 illustrates the “pruning” function performed by the imagerecognition software 10 to determine which features should be used tomake presence/absence determinations. The exemplary number lines for theseven features shown in FIG. 23 were based on running sample PWAs havingthe same regions of interest to determine if the features of FIG. 21 arerepeating. Samples S1, S2, and S3 associated with a “-” symbol belowthem represent three samples run where the components were absent (i.e.,three blank or bare boards), while the samples S1, S2, and S3 associatedwith a “x” symbol below them represent three samples run where thecomponents were present (i.e., three assembled boards). FIG. 23 includesa number line for each feature 1-1 through feature 6 (items 91 through97) that includes the score for that feature for each of the sixsamples. The score for each was generated using the image recognitionsoftware 10 as previously described.

[0130] Examining number line 97 for feature 6 shows that feature 6scored as follows: the first absent sample (S1_) scored 100%, the secondabsent sample (S2_) scored 80%, and the third absent sample (S3_) scored90%; likewise, the first present sample (S1 _(x)) scored 20%, the secondpresent sample (S2 _(x)) scored 10%, and the third present sample (S3_(x)) scored 0%. Note that feature 6 only contained 10 pixels, so thatall scores resulted in multiples of 10%. As pixel counts within featuresrise, the more variability occurs within the scoring numbers. Examiningnumber line 96 for feature 5 shows an even tighter grouping with scoresas follows: the first absent sample (S1_) scored 68.75%, the secondabsent sample (S2_) scored 68.75%, and the third absent sample (S3_)scored 71.875%; while the first present sample (S1 _(x)) scored 25%, thesecond present sample (S2 _(x)) scored 6.25%, and the third presentsample (S3 _(x)) scored 12.5%. Contrast feature 5 with feature 4 wherethe feature 4 third absent sample (S3_) scored 50% and actually crossedover second present sample (S2 _(x)) which scored 54.17%.

[0131] In order to determine the significance of the groupings for eachfeature, image recognition software 10 will calculate the mean (μ) andstandard deviation (δ) for each class (present/absent) for each feature.For feature 6, the absent class mean μ_ equals 90%, absent standarddeviation δ_ equals 10%, while present class mean μ_(x) equals 10%, andpresent standard deviation δ_(x) equals 10%. Means and standarddeviations for both classes for all other features are similarlycalculated by image recognition software 10. Image recognition software10 then calculates a pruning constant K for each class according to thefollowing formulae:

K_=(μ_−μ_(x))/δ_(—)  (5)

K _(x)=(μ_−μ_(x))/δ_(x)  (6)

[0132] Thus, for feature 5, absent pruning constant K=30.6 and presentpruning constant K_(x)=5.78. For feature 5, the pruning constant of 30.6means that the mean for the K_class is K_separated by 30.6 standarddeviations, whereas the mean for the K_(x) class is separated by 5.78standard deviation. Pruning constant K is a metric to rank the variousfeatures against one another in order to determine the best features touse to determine presence and absence. For each feature, the minimumpruning constant is determined and, for the example of FIG. 23, theseven minimum pruning constants are compared. The smaller the pruningconstant, the worse the feature is for purposes of makingpresence/absence determinations. As shown in FIG. 23, feature 6 has aminimum pruning constant of 8, feature 5 has a minimum pruning constantof 5.78, feature 4 has a minimum pruning constant of 1.66, feature 3 hasa minimum pruning constant of 7.67, feature 2 has a minimum pruningconstant of 13.29, feature 1-2 has a minimum pruning constant of 0.44,and feature 1-1 has a minimum pruning constant of 3.93 (as indicated bythe boxed values). It can be readily seen that when the classes cross(as in feature 4 and feature 1-2), the pruning constant will berelatively low, whereas when the classes maintain good separation (as infeature 2) the pruning constant will be relatively high.

[0133] The image recognition software 10 now performs the actual pruningof features to select the best features for making presence/absencedeterminations using a pruning rule. The pruning rule for our examplehaving seven features will be to keep the four features that have thelargest minimum pruning constants. Thus, the top four out of sixfeatures will be retained. An additional pruning rule can beincorporated to remove any features where the minimum pruning constantdoes not exceed 0.5. Applying these pruning rules to the features ofFIG. 23 results in retaining features 2, 3, 5 and 6 for use in presenceabsence verification. For example, pruning rule in operating imagerecognition software 10 acting on PWAs will likely have pruning rulessimilar to: 1) remove all features with minimum pruning constants lessthan 0.5 and 2) keep a maximum of 50 features. The pruning constantminimum is used to obtain solid features in order to optimizeperformance. The maximum feature rule is used to optimize speed ofoperation.

[0134] At the end of the pruning function, the four remaining featuresand the scores of those remaining features represent the knowledge basefor that imaged ROI. As more boards are run, the knowledge base can beexpanded to include additional data acquired and calculated by imagerecognition software program 10. The knowledge bases are stored inmemory accessible by image recognition software program 10. In analternative embodiment, the features that were pruned out can bemaintained in a data base for future comparison and potential inclusionin the knowledge base at a later time (e.g., if other samples cause thepruning constants of the remaining features to be lowered).

[0135] Any region of interest on a PWA or object can now be imaged bythe inspection system to allow the image recognition software 10 toperform feature classification for the region of interest. Featureclassification is the process of classifying the feature as present orabsent (or right or wrong polarity for polarity determinations). FIG. 24shows exemplary test image scores for each of the pruned features ofFIG. 23 for a test region of interest having those pruned features. Thetest region of interest feature scores are overlayed on the existingknowledge base numberlines of FIG. 23. For example, test score 116 forfeature 5, represented as T₅, is included on feature 5 number line 96,test score 114 for feature 3 is included on feature 3 number line 94,etc. Image recognition software 10 will determine the minimum distancebetween the test score value and a sample score for each class (from theknowledge base). The image recognition software 10 will call the testfeature present if the test feature score is closer to the presentsample, or absent if the test score is closer to the absent sample.

[0136] To illustrate, feature 5 number line 96 shows that feature 5 testscore 116 is 85%. The closest absent feature 5 score (an S score) is theS3_score of 71.875%, while the closest present feature 5 score (an S_(x)score) is the S1 _(x) score of 25%. The minimum test-to-absent classscore for feature 5 (indicated by item 128) is (85-71.875) which equals13.125, while the minimum test-to-present class score for feature 5(indicated by item 126) is 85-25 which equals 60. The image recognitionsoftware 10 has determined that the test feature 5 score lies closer tothe absent sample scores (because 13.125 is less than 60). Thus, thefeature 5 class decision 128 is “13.125 absent”. Similarly, test feature3 score 114 has a minimum distance 120 to closest present sample feature3 score and minimum distance 122 from the closest absent sample feature3 score. Test-to-present distance 120 for feature 3 is 71.39, whiletest-to-absent distance 122 is 4.72. A similar calculation can beperformed by image recognition software 10 on each test feature scorerelative to every feature that is kept after pruning (in our example,features 2, 3, 5 and 6). In our example test image, test feature 6 has atest-to-present distance 124 of 20 and a test-to-absent distance 134 of40, while test feature 2 has a test-to-present distance 128 of 48.89 anda test-to-absent distance 132 of 28.89. These calculations are shown inTable 9. TABLE 9 CLASS FEATURE CLASS CALCULATION MINI- CLASS SET × − MUMDECISION F₂ 48.89 28.89 28.89 (−) ABSENT (60.00 − 11.11) (88.89 − 60.00)F₆ 20   40   20 (×) ABSENT (40.00 − 20.00) (80.00 − 40.00) F₃ 71.39 4.72 4.72 (−) ABSENT (82.50 − 11.1)  (82.50 − 77.78) F₅ 60    13.12513.125 (−) ABSENT (85.00 − 25.00)  (85.00 − 71.875)

[0137] An interesting point on these exemplary test region of interestscores is that three of the four distances indicate the feature isabsent, while the fourth (feature 6) indicates the feature is present.In order to make an overall class determination (present versus absent)for the region of interest, the image recognition software 10 furthermanipulates these distance determinations.

[0138] The image recognition software 10 now takes these individualtest-to-class feature distances for the features that are kept afterpruning (in our example, features 5, 3, 6 and 2, having test-to-classfeature distances 126, 128, 120, 122, 124, 134, 128 and 132) andmanipulates them using some metric to determine whether the componentmade up by these features is present or absent. Image recognitionsoftware 10 can perform a calculation to determine the net Euclideandistance for the entire region of interest (ROI D_(i)) from the featuresto the classes according to the formula: $\begin{matrix}{\left( {\frac{1}{N}{\sum\limits_{1}^{N}\quad D_{i}^{2}}} \right)^{1/2} = {{ROI}\quad D_{i}}} & (7)\end{matrix}$

[0139] where i is the class, N is the total number of individualfeatures and D_(i) represents the test-to-sample feature distances forthe class. Thus, the ROI D_(i) Euclidean Distance is determined for theregion of interest for both absent and present classes. For any regionof interest, the image recognition software 10 will place the region ofinterest in the class associated with the minimum Euclidean distancebetween the region of interest test scores and the absent/present classscores. For our example, the absent Euclidean distance ED_is 25.638,while the present Euclidean distance ED_(x) is 53.588. For the region ofinterest of our example, the minimum Euclidean distance of 25.638 isassociated with an absent class, therefore the image recognitionsoftware 10 would determine the component in the region of interest isabsent. It should be understood that any number of metrics could be usedto determine the region of interest class rather than the Euclideandistance (for example, the standard deviation of the Euclideandistance). In an alternative embodiment, the Euclidean norm (or othermetric) could be used as the metric.

[0140] A class determination has now been performed for each of theindividual features and the overall region of interest made up fromthose features. The image recognition software 10 can now perform adecision confidence calculation to determine a confidence factor foreach of these class determinations. Decision confidences are calculatedfrom the formulae:

FEATURE CONFIDENCE (%)=[MAX D _(i)/(D _(—) +D _(x))]*100  (8)

[0141] (where MAX D_(i) is the maximum of D_+D_(x) for each feature)

[0142] for the individual feature decision confidences and:

ROI CONFIDENCE (%)=[MAX ED_(i)/(ED_(−i)+ED_(+i)]*100  (9)

[0143] (where MAX ED_(i) is the maximum of ROI D_or ROI D_(x))

[0144] Thus, the decision confidence is a ratio of the distances betweenthe test scores and the present/absent scores in the knowledge base. Forthe example of FIG. 24, the region of interest decision confidence iscalculated as [53.588/(53.588+25.638)] which equals 67.64%. All of theclass determinations and decision confidences for both the individualfeatures and the overall component are provided in TABLE 10. TABLE 10DECISION FEATURE SET D_ D_(X) CLASS_(MIN) CONFIDENCE F₂ 28.89 48.89 −62.86% F₆ 40 20 × 66.67% F₃ 4.72 71.39 − 93.80% F₅ 13.125 60 − 82.05%OVERALL ROI 25.638 53.588 − 67.64%

[0145] Table 10 illustrates that for the test region of interest imagedagainst the four features in the knowledge base, the image recognitionsoftware 10 decided the overall class for the region of interest wasabsent with a decision confidence of 67.64%. Under the methodologydescribed above, a decision confidence could never fall below 50% or beabove 100%. To further illustrate, a decision confidence of 50%indicates the test score was an equal distance from either class; adecision confidence of 66.67% is a metric indicating that the test scorewas twice as close to one class as the other; a confidence of 75%indicates, the test score was three times closer to one class than theother; a confidence of 90% indicates the test score was nine timescloser to one class than the other.

[0146] In one embodiment of the image recognition program 10 of thepresent invention, any individual test region of interest result (e.g.,those contained in Table 10) can be added to the knowledge base toincrease the data available in the knowledge base. The decision to add aparticular test result to the knowledge base could be made and executedby an operator manually, or could be performed automatically for alltest results having a decision confidence that falls below apredetermined threshold.

[0147] Another aspect of the present invention is to provide, inaddition to the class decision and the decision confidence, a relativeconfidence value and an extended confidence value. The relativeconfidence compares the feature class decisions and feature confidencesto the overall ROI class decision and ROI decision confidence. Therelative confidence value serves to provide another measure ofconfidence to prevent defects from escaping the image recognitionprogram 10. In our example of Table 10, despite the overall absent classdetermination for the region of interest, feature 6 actually had apresent class determination at a confidence level of 66.67%. Thistoggling from absent to present between features indicates that whilethis region of interest appears not to have a component at features 2,3, and 5, there does appear to be a component at region 6. In otherwords, a component has extended to an area (encompassed by feature 6)that it typically does not occupy. This could occur, for example, with adamaged component:. However, the overall effect of the feature 6“present” decision was not enough to toggle the entire decision to“present”, but the effect was to lower the overall decision confidence.For example, if the decision confidence for this region of interestbased on these four features is typically 90%, then feature 6 wouldtypically give an absent class when features 2, 3 and 5 do. Therefore,this example would be classified as absent, but would not behave as atypical absent classification would (i.e., the confidence is low) andcould therefore represent a defect.

[0148] In order to protect against defect escapes such as describedabove, the image recognition software 10 compares the overall region ofinterest decision confidence to the typical decision confidence for thatregion of interest from previous runs. If the overall ROI decisionconfidence is too far from the typical ROI decision confidence, theimage recognition program 10 flags it as a relative confidence errorthat must be investigated further. In one embodiment, the imagerecognition program 10 will flag a relative confidence error if theoverall ROI decision confidence is greater than or less than the mean ofthe previous ROI decision confidences plus or minus some number ofstandard deviations as illustrated by the following formula:

IF DC>or<(μ^(N) ±kδ ^(N))→RCE  (10)

[0149] where DC is the decision confidence value of interest, μ is themean decision confidence calculated from a floating window of theprevious N decision confidence values for the region of interest, δ isthe standard deviation of the decision confidence calculated from thesame N values, k is a constant, and RCE is a relative confidence error.The mean and standard deviation can be calculated over a floating numberof previous ROI decision confidences (N) that can be operatorselectable. For example, in one embodiment the previous 50-100 decisionconfidence values are used to calculate the mean and standard deviation.The constant k simply defines how many standard deviations away from themean an acceptable new decision confidence can be without flagging arelative decision confidence error.

[0150]FIG. 25A is a graph showing six consecutive decision confidencevalues for a particular region of interest. FIG. 25B is a graphillustrating the floating window relative confidence calculationsperformed by the image recognition software 10 of the present invention.With reference to FIGS. 25A and 25B, the relative confidence bounds arecalculated with a floating window of N=5 and a constant k=2, with theresults contained in Table 11. The first and second ROI decisionconfidence values are 85% so that the upper and lower bounds fordetermining relative confidence errors is zero. After the third ROIdecision of 84%, the upper and lower bounds within with an ROI decisionwill not be flagged as a relative confidence error are 85.6 and 83.8which are calculated from all three ROI decision confidences. Thiscontinues through the first five decision confidences. At the sixth ROIdecision confidence, the first: RIO decision confidence is dropped outand only the second through sixth ROI decision confidences remain withinthe floating window and are used to calculate the upper and lowerrelative decision confidence bounds. The results of the calculations areshown in TABLE 11. TABLE 11 FLOATING STANDARD UPPER LOWER MEAN (μ)DEVIATION kδ BOUND BOUND (N = 5) (δ) (k = 2) (μ + kδ) (μ − kδ) μ₁ = 85  0 2δ = 0   85 85 μ₂ = 85   0 2δ = 0   85 85 μ₃ = 84.7 .47 2δ = 0.94 85.783.8 μ₄ = 85   .71 2δ = 1.42 86.4 83.6 μ₅ = 85.4 1.02 2δ = 2.0  87.483.4 μ₆ = 85.6 1.02 2δ = 2.0  87.6 83.6

[0151] The extended relative confidence goes beyond the relativeconfidence analysis to spatially cluster the individual feature decisionconfidences for a region of interest to make a determination of the typeor subclassification of defect present based on the relative confidenceerrors. FIG. 26 shows an ROI 90 to which the image recognition software10 will apply spatial heuristic rules to determine the defectsubclassification. The defect subclassifications that can be determinedusing the present invention include but are not limited to criticallyskewed components, tombstoned components, billboarded components,damaged components, wrong components, upside down components, andforeign material on the ROI. The image recognition software 10 candetermine which of these various component level defects exist byexamining the area immediately outside the component body 140 (Region A)and the component body area 142 (Region B).

[0152] For a critically skewed component, the feature boxes in Region Ashow a deviation from normal scores (in other words, feature boxes inRegion A should generate similar-scores when the component is bothpresent and absent, and different scores if the component: is present,but skewed) and the feature boxes in Region B tend towards lowerconfidence present scores to higher confidence absent scores. Criticallyskewed components result in a structured distribution of clusters inboth Region A and Region B. For tombstoned components, the feature boxesin Region A show normal scores, while feature boxes in Region B tendtowards low-confidence present to high-confidence absent scores alongthe minor edge of Region B spreading towards the center of thecomponent. Tombstoned components results in a structured distribution ofclusters in Region B. For billboarded components, the feature boxes inRegion A show normal scores, while feature boxes in Region B tendtowards low confidence present to high confidence absent scores along amajor edge of Region B spreading towards the center. Like tombstonedcomponents, billboarded components result in a structured distributionof clusters in Region B. For damaged components, the feature boxes inRegion A show normal scores, while the feature boxes in Region B tendtoward low-confidence present to high-confidence absent scores in thedamaged areas. Damaged components typically result in an unstructureddistribution of clusters in Region B. For wrong or incorrect:components, the feature boxes in Region A will show normal scores, whilefeature boxes in Region B tend toward low-confidence present tohigh-confidence absent scores. Wrong components result in asemi-structured distribution of clusters in Region B. For foreignmaterial in Region B, the feature boxes in Region A show normal scores,while the feature boxes in Region B tend toward low-confidence presentto high-confidence absent scores in the area of foreign material.Foreign material in Region B results in an unstructured distribution ofclusters in Region B. For foreign material in Region A, the featureboxes in Region A show a deviation from normal scores in the foreignmaterial area, while the feature boxes in Region B show-normal scores.Foreign material in Region A results in an unstructured distribution ofclusters in Region A. In all of the cases described, some number offeature boxes in both Region A and Region B will almost certainly shownormal scores even when a defect is present. It is the tendenciesdescribed above that allow the present invention to subclassify apresence/absence defect into one of the above subclasses.

[0153]FIG. 26 shows a particular example of how the extended relativeconfidence analysis is performed by the image recognition software 10 ofthe present invention. As can be seen in FIG. 26, the region of interest90 is composed of the component body 142 Region B plus an area outsidethe component body Region A so that Region A+Region B represents theentire region of interest. Region B, the component body 142, alsoincludes three sub-regions 144, 146, and 148. As shown in FIG. 26,sub-regions 144 and 148 represent land area and sub-region 146represents non-land area. “Land areas” are the electrical bonding areas.

[0154] To further illustrate the benefits of relative confidence andextended relative confidence analyses performed by the presentinvention, assume a component is present, but skewed from its normallocation. The image recognition software 10 will examine the featuresand will classify most of the features for the region of interestcontaining the component as present, while a few features will beclassified as absent (because the component is skewed and these featureshave been uncovered), though the overall class decision will be present.The relative confidence analysis will then show a decision confidencevalue outside the normal decision confidence values and the image willbe flagged for low (or high) confidence that exceeds the confidencewindow (IKT), which indicates a relative confidence error. The operatorcan now go examine the component, determine it is skewed and repair theproblem. However, the extended relative confidence goes beyond therelative confidence analysis to spatially group the feature decisionconfidences for the region of interest to actually classify that thepart was skewed. The manufacturing process can see tremendous benefitfrom tracking the types/subclassifications of defects present.

[0155]FIG. 27 shows a listing of pseudo-code 150 for one embodiment ofthe image recognition software 10 of the present invention. Thepseudo-code 150 includes a feature space generation subroutine 152, acolor reduction subroutine 154, a feature generation subroutine 156, afeature vector subroutine 158, a defect classification subroutine 160, arelative confidence subroutine 162, and an extended relative confidenceanalysis 164. The pseudo-code 150 further illustrates the imagerecognition and defect classification methodology of one embodiment ofthe present invention.

[0156] Although the present invention has been described in detail, itshould be understood that various changes, substitutions and alterationscan be made hereto without departing from the spirit and scope of theinvention as described by the appended claims.

What is claimed is:
 1. A method for dynamic image recognition for makingdeterminations about regions of interest on an object using an imagerecognition computer program contained in computer-readable form on atangible storage medium, comprising the steps of executing the imagerecognition computer program to: load a knowledge base containing a setof features and past decision confidences for each region of interestfor the object to be imaged; acquiring a raw gray level image of theobject comprising a set of raw pixels, each raw pixel having a graylevel value; derive a number of distinct spaces from the raw pixelimage; score each feature for each region of interest on each of thederived spaces; classify each feature for presence/absence or polarity;calculate decision confidence for each feature; and calculate a relativedecision confidence for each feature to provide a metric that comparesthe decision confidence for each feature to past decision confidencesfor the feature contained in the knowledge base; if the relativedecision confidence is outside of a predetermined window, classify thefeature as a defect; and perform an extended relative confidenceanalysis to subclassify the defect.
 2. The method of claim 1, whereinthe step of executing the image recognition software to derive a numberof distinct spaces comprises deriving five distinct spaces by executingthe image recognition software to: derive a reduced zero order magnitudespace; derive a reduced first order magnitude space; derive a firstorder direction space; derive a reduced second order magnitude space;and derive a second order direction space.
 3. The method of claim 2,wherein the deriving the five distinct spaces further comprises:deriving the reduced zero order magnitude space by reducing each rawimage pixel gray level value to a zero order reduced gray level valueaccording to a zero order reduction transform; deriving the reducedfirst order magnitude space by creating a first order magnitude space bydetermining the maximum difference between the raw pixel gray levelvalue for each pixel and its eight immediately adjacent pixels and thenreducing the first order magnitude space according to a first orderreduction. transform; deriving the first order direction space from theraw image by determining a first order direction code for each pixelbased on the direction of the lowest of the eight adjacent pixels fromeach pixel according to a first order direction map; deriving thereduced second order magnitude space by creating a second ordermagnitude space from the first order magnitude space by determining themaximum difference between the first order pixel gray level value foreach pixel and its eight immediately adjacent pixels and then reducingthe second order magnitude space according to a second order reductiontransform; deriving the second order direction space from the firstorder magnitude space by determining a second order direction code foreach pixel based on the direction of the lowest of the eight adjacentpixels from each pixel according to a second order direction map.
 4. Themethod of claim 3, wherein the zero gray scale reduction transformreduces pixels values from 256 to N values, the first order reductiontransform reduces pixel values from 256 to N values, and the secondorder reduction transform reduces pixel values from 256 to N values, andwherein the first order direction map provides first order directioncodes based on the direction of the lowest raw gray level value of theeight adjacent pixels and the second order direction map provides secondorder direction codes based on the direction of the lowest first ordergray level value of the eight adjacent pixels.
 5. The method of claim 4,wherein the image recognition software performs a histogram on the imageto be reduced to determine a set of break points for each reduced code.6. The method of claim 4, wherein N is less than
 256. 7. The method ofclaim 5, wherein deriving the zero, first and second order magnitudespaces further comprises performing a ramping to give each pixel near achange over code point a relative code value.
 8. The method of claim 7,wherein the ramp is a zero to five ramp across a five pixel horizontalrange.
 9. The method of claim 1, further comprising executing the imagerecognition software to preprocess each region of interest, comprisingperforming on each region of interest (1) scaling, (2) gain and offsetcorrection, and (3) gamma correction.
 10. The method of claim 2, whereinexecuting the image recognition software to score the features furthercomprises: creating a knowledge base for presence/absence by: generatingeach presence/absence feature for each derived space from at least oneblank object; scoring each presence/absence feature for each derivedspace from a first blank object; and scoring each presence/absencefeature for each derived space from every other blank object imaged;scoring each presence/absence feature for each derived space from eachassembled object; creating a knowledge base for polarity by: generatingeach polarity feature for each derived space from a first assembledobject; rotating the feature images to generate wrong polarity features;and scoring each polarity feature for each derived space for everyassembled object imaged.
 11. The method of claim 10, wherein eachpresence/absence feature generated and each polarity feature generatedhas an arbitrary geometry based on a set of feature generation rules.12. The method of claim 10, wherein the number of presence/absencefeatures and the number of polarity features generated in each derivedspace is not predetermined prior to generation.
 13. The method of claim2, wherein executing the image recognition software to score thefeatures further comprises: scoring features in each direction space bygiving each feature a score equal to the number of direction codes onthe image that match the direction codes of the feature in the knowledgebase according to the formula: SCORE (K)=ΣP(i,j) for P(i,j)εBB_(k) whereP(i,j)=1, if code (P)=code (K) 0, otherwise; and where K is a feature,BB_(k) is a bounding box bounding feature K, and P(i,j) are the pixelswithin feature K.
 14. The method of claim 10, further comprisingexecuting the image recognition software to prune the features in theknowledge base.
 15. The method of claim 14, further comprising executingthe image recognition software to: determine a mean and standarddeviation for a predetermined sample of imaged objects for bothpresence/absence feature scores and polarity feature scores; calculate apruning constant for both presence/absence and polarity; and selectingthe presence/absence features and the polarity features to be used forscoring based upon predetermined pruning rules.
 16. The method of claim15, wherein the predetermined pruning rules comprise 1) remove allfeatures with minimum pruning constants less than 0.5, 2) keep a maximumof 50 features, and 3) keep the maximum pruning constants.
 17. Themethod of claim 1, wherein the knowledge base comprises a databasecontaining a set of features and scores for each region of interest. 18.The method of claim 1, wherein the step of executing the imagerecognition software to derive a number of distinct spaces furthercomprises executing the image recognition software to: derive a reducedzero order magnitude space; derive a reduced first order magnitudespace; derive a first order direction space; derive a reduced secondorder magnitude space; derive a second order direction space; derive areduced third order magnitude space; and derive a third order directionspace.
 19. The method of claim 1, further comprising executing the imagerecognition software to: perform a set of clustering rules on thederived spaces to create an arbitrary number of presence/absencefeatures, each presence/absence feature having an arbitrary geometry andan arbitrary number of polarity features, each polarity feature havingan arbitrary geometry.
 20. A method of creating a knowledge base for usein image recognition for images on a set of derived spaces, comprising:imaging at least one blank object; creating a presence/absence knowledgebase by: generating a set of presence/absence features for each derivedspace from at least one blank object; scoring each presence/absencefeature for each derived space from a first blank object; and scoringeach presence/absence feature for each derived space from every otherblank object and every assembled object imaged; creating a polarityknowledge base by: generating a set of polarity features for eachderived space from a first assembled object; rotating the each featureimage to generate a set of wrong polarity features; and scoring eachpolarity feature for each derived space for every assembled objectimaged.
 21. The method of claim 20, wherein each presence/absencefeature generated and each polarity feature generated has an arbitrarygeometry based on a set of feature generation rules.
 22. The method ofclaim 20, wherein the number of presence/absence features and the numberof polarity features generated in each derived space is notpredetermined prior to generation.
 23. The method of claim 20, whereinscoring the features further comprises scoring features in eachdirection space by giving each feature a score equal to the number ofdirection codes on the image that match the direction codes of thefeature in the knowledge base according to the formula: SCORE(K)=ΣP(i,j) for P(i,j)εBB_(k) where P(i,j)=1, if code (P)=code (K) 0,otherwise; and where K is a feature, BB_(k) is a bounding box boundingfeature K, and P(i,j) are the pixels within feature K.
 24. The method ofclaim 20, further comprising pruning the features in the knowledge base.25. The method of claim 24, further comprising: determining a mean andstandard deviation for a predetermined sample of imaged objects for bothpresence/absence feature scores and polarity feature scores; calculatinga pruning constant for both presence/absence and polarity; and selectingthe presence/absence features and the polarity features to be used forscoring based upon predetermined pruning rules.
 26. The method of claim25, wherein the predetermined pruning rules comprise 1) remove allfeatures with minimum pruning constants less than 0.5, 2) keep a maximumof 50 features, and 3) keep the maximum pruning constants.
 27. Themethod of claim 20, wherein the knowledge base initially comprises adatabase containing a set of features and scores.
 28. The method ofclaim 20, further comprising deriving a number of distinct spaces,comprising: derive a reduced zero order magnitude space; derive areduced first order magnitude space; derive a first order directionspace; derive a reduced second order magnitude space; and derive asecond order direction space.
 29. The method of claim 20, furthercomprising performing a set of clustering rules on the derived spaces tocreate an arbitrary number of presence/absence features, eachpresence/absence feature having an arbitrary geometry and an arbitrarynumber of polarity features, each polarity feature having an arbitrarygeometry.
 30. A method for dynamic image recognition for makingdeterminations about regions of interest on an object using an imagerecognition computer program contained in computer-readable form on atangible storage medium, comprising the steps of executing the imagerecognition computer program to: acquiring a raw gray level image of theobject comprising a set of raw pixels, each raw pixel having a graylevel value; derive a number of distinct spaces from the raw pixelimage; cluster the raw pixel images for each distinct space based on aset of clustering rules; and generate a set of features for each regionof interest in each distinct space, each feature having an arbitrarygeometry.
 31. The method of claim 30, further comprising executing theimage recognition software program to: load a knowledge base containinga set of features and past decision confidences for each region ofinterest for each derived space for the object to be imaged; score eachfeature for each region of interest on each of the derived spaces;classify each feature for presence/absence or polarity; calculatedecision confidence for each feature; and calculate a relative decisionconfidence for each feature to provide a metric that compares thedecision confidence for each feature to past decision confidences forthe feature contained in the knowledge base; if the relative decisionconfidence is outside of a predetermined window, classify the feature asa defect; and perform an extended relative confidence analysis tosubclassify the defect.
 32. The method of claim 31, wherein the step ofexecuting the image recognition software to derive a number of distinctspaces comprises deriving five distinct spaces by executing the imagerecognition software to: derive a reduced zero order magnitude space;derive a reduced first order magnitude space; derive a first orderdirection space; derive a reduced second order magnitude space; andderive a second order direction space.
 33. The method of claim 32,wherein the deriving the five distinct spaces further comprises:deriving the reduced zero order magnitude space by reducing each rawimage pixel gray level value to a zero order reduced gray level valueaccording to a zero order reduction transform; deriving the reducedfirst order magnitude space by creating a first order magnitude space bydetermining the maximum difference between the raw pixel gray levelvalue for each pixel and its eight immediately adjacent pixels and thenreducing the first order magnitude space according to a first orderreduction transform; deriving the first order direction space from theraw image by determining a first order direction code for each pixelaccording to a first order direction map; deriving the reduced secondorder magnitude space by creating a second order magnitude space fromthe first order magnitude space by determining the maximum differencebetween the first order pixel gray level value for each pixel and itseight immediately adjacent pixels and then reducing the second ordermagnitude space according to a second order reduction transform;deriving the second order direction space from the first order magnitudespace by determining a second order direction code for each pixel basedon the direction of the lowest of the eight adjacent pixels from eachpixel according to a second order direction map.
 34. The method of claim33, wherein the zero gray scale reduction transform reduces pixelsvalues from 256 to N values, the first order reduction transform reducespixel values from 256 to N values, and the second order reductiontransform reduces pixel values from 256 to N values, and wherein thefirst order direction map provides first order direction codes based onthe direction of the lowest raw gray level value of the eight adjacentpixels and the second order direction map provides second orderdirection codes based on the direction of the lowest first order graylevel value of the eight adjacent pixels.
 35. The method of claim 34,wherein the image recognition software performs a histogram on the imageto be reduced to determine a set of break points for each reduced code.36. The method of claim 34, wherein N is
 12. 37. The method-of claim 31,wherein executing the image recognition software to score the featuresfurther comprises: creating a presence/absence knowledge base by:generating each presence/absence feature for each derived space from atleast one blank object; scoring each presence/absence feature for eachderived space from a first blank object; and scoring eachpresence/absence feature for each derived space from every other blankobject imaged; creating a polarity knowledge base by: generating eachpolarity feature for each derived space from a first assembled object;rotating the feature images to generate wrong polarity features; andscoring each polarity feature for each derived space for every assembledobject imaged.
 38. The method of claim 37, wherein the number ofpresence/absence features and the number of polarity features generatedin each derived space is not predetermined prior to generation.
 39. Themethod of claim 37, wherein executing the image recognition software toscore the features further comprises: scoring features in each directionspace by giving each feature a score equal to the number of directioncodes on the image that match the direction codes of the feature in theknowledge base according to the formula: SCORE (K)=ΣP(i,j) for P(i,j)εBB_(k) where P(i,j)=1, if code (P)=code (K) 0, otherwise; and where K is afeature, BB_(k) is a bounding box bounding feature K, and P(i,j) are thepixels within feature K.
 40. The method of claim 39, further comprisingexecuting the image recognition software to: determine a mean andstandard deviation for a predetermined sample of imaged objects for bothpresence/absence feature scores and polarity feature scores; calculate apruning constant for both presence/absence and polarity; selecting thepresence/absence features and the polarity features to be used forscoring based upon predetermined pruning rules; and pruning the featuresin the knowledge base.
 41. A method for dynamic image recognition,comprising: collecting raw image data from at least one imaged object;segmenting out a region of interest; performing at least one spatialimage transform to generate a set of derived spaces for the region ofinterest; and clustering the region of interest to generate a set offeatures for each derived space based on a set of clustering rules togenerate arbitrary features on the region of interest for each derivedspace.
 42. The method of claim 41, wherein performing a spatial imagetransform to generate a set of derived spaces for the region ofinterest, comprises; deriving a reduced zero order magnitude space;deriving a reduced first order magnitude space; deriving a first orderdirection space; deriving a reduced second order magnitude space; andderiving a second order direction space.
 43. The method of claim 42,wherein the deriving the set of derived spaces further comprises:deriving the reduced zero order magnitude space by reducing each rawimage pixel gray level value to a zero order reduced gray level valueaccording to a zero order reduction transform; deriving the reducedfirst order magnitude space by creating a first order magnitude space bydetermining the maximum difference between the raw pixel gray levelvalue for each pixel and its eight immediately adjacent pixels and thenreducing the first order magnitude space according to a first orderreduction transform; deriving the first order direction space from theraw image by determining a first order direction code for each pixelbased on the direction of the lowest of the eight adjacent pixels fromeach pixel according to a first order direction map; deriving thereduced second order magnitude space by creating a second ordermagnitude space from the first order magnitude space by determining themaximum difference between the first order pixel gray level value foreach pixel and its eight immediately adjacent pixels and then reducingthe second order magnitude space according to a second order reductiontransform; deriving the second order direction space from the firstorder magnitude space by determining a second order direction code foreach pixel based on the direction of the lowest of the eight adjacentpixels from each pixel according to a second order direction map. 44.The method of claim 41, wherein the region of interest is a componentsite defined by CAD data.
 45. The method of claim 41, further comprisingpreprocessing the region of interest, comprising; performing a region ofinterest scaling; performing a gain and offset correction; andperforming a gamma correction.
 46. The method of claim 41, wherein eachstep is performed for a plurality of regions of interest.
 47. The methodof claim 41, further comprising: creating a presence/absence knowledgebase by: generating each presence/absence feature for each derived spacefrom at least one blank object; scoring each presence/absence featurefor each derived space from a first blank object; and scoring eachpresence/absence feature for each derived space from every other blankobject and each assembled object imaged; creating a polarity knowledgebase by: generating each polarity feature for each derived space from afirst assembled object; rotating the feature images to generate wrongpolarity features; and scoring each polarity feature for each derivedspace for every assembled object imaged.
 48. The method of claim 47,wherein the number of presence/absence features and the number ofpolarity features generated in each derived space is not predeterminedprior to generation.
 49. The method of claim 47, wherein executing theimage recognition software to score the features further comprises:scoring features in each direction space by giving each feature a scoreequal to the number of direction codes on the image that match thedirection codes of the feature in the knowledge base according to theformula: SCORE (K)=ΣP(i,j) for P(i,j)εBB _(k) where P(i,j)=1, if code(P)=code (K) 0, otherwise; and where K is a feature, BB_(k) is abounding box bounding feature K, and P(i,j) are the pixels withinfeature K.
 50. The method of claim 49, further comprising executing theimage recognition software to: determine a mean and standard deviationfor a predetermined sample of imaged objects for both presence/absencefeature scores and polarity feature scores; calculate a pruning constantfor both presence/absence and polarity; selecting the presence/absencefeatures and the polarity features to be used for scoring based uponpredetermined pruning rules; and pruning the features in the knowledgebase.
 51. A method for performing basic training in a dynamic imagerecognition system, comprising: collecting raw image data from at leastone blank object; segmenting out a region of interest on the at leastone blank object; performing at least one spatial image transform togenerate a set of derived spaces for the region of interest; generatinga set of presence/absence features for the at least one blank object,comprising; spatially clustering similar presence/absence pixel codes ineach derived space to create a set of presence/absence features; andrepresenting each significant presence/absence feature as one or morepresence/absence boxes; scoring each presence/absence box on each blankobject, thereby building a blank object presence/absence score set;collecting raw image data from at least one assembled object; segmentingout a region of interest on the at least one assembled object;performing at least one spatial image transform to generate a set ofderived spaces for the region of interest; scoring each present/absencebox on each assembled object, thereby building an assembled boardpresence/absence score set; building a presence/absence knowledge baseusing the blank object presence/absence score set and the assembledobject presence absence score set; pruning each presence/absence box;generating a set of polarity features from a first assembled object,comprising; spatially clustering similar polarity-pixel codes in eachderived space to create at least one polarity feature; and representingeach significant polarity feature as one or more polarity boxes; scoringeach polarity box on each assembled object, thereby building anassembled object score set; building a polarity knowledge base using theassembled object score set; and pruning each polarity box.
 52. Themethod of claim 51 further comprising performing inspection of anobject, comprising: collecting raw image data from the object;segmenting out a region of interest on the object; performing at leastone spatial image transform to generate a set of derived spaces for theregion of interest.; generating a set of presence/absent feature boxesand a set of polarity feature boxes for the object; determining thepresence and or absence of each feature within the set of feature boxes,comprising; scoring the presence/absence feature boxes for the object;passing the presence/absence feature box scores for the object throughthe presence absence knowledge base; calculating a presence/absencedecision confidence for each feature; calculating a presence/absencerelative, confidence for each feature to provide a metric to compareeach presence/absence decision confidence for each feature to a set ofpast presence/absence decision confidences for each feature; if therelative decision confidence is outside of a predetermined window,classify the feature as a defect and performing an extendedpresence/absence relative confidence analysis to subclassify the defect.53. The method of claim 52, further comprising: determining the polarityof each feature within the set of feature boxes, comprising scoring eachpolarity feature box; passing each polarity feature box score throughthe polarity knowledge base, comprising; generating a polarity decisionconfidence for each feature; calculating a polarity relative decisionconfidence for each feature to provide a metric to compare each polarityconfidence for each feature to a set of past polarity decisionconfidences for each feature; if the polarity relative decisionconfidence is outside of a predetermined window, classify the feature asa defect.
 54. The method of claim 53, further comprising performingincremental training to update the presence/absence and polarityknowledge bases.
 55. The method of claim 52, wherein thepresence/absence defect subclassifications include skewed, tombstoned,billboarded, damaged, new, and wrong components and foreign material.56. The method of claim 52, wherein performing a presence/absencerelative confidence analysis to detect presence/absence component leveldefects further comprises: computing a mean (μ) and standard deviation(δ) over a sliding window of the presence/absence decision confidences;and flagging any presence/absence decision having a confidence leveloutside a predetermined window.
 57. The method of claim 56, wherein thepredetermined window includes values of μ±kδ where k is a relativeconfidence flag boundary.
 58. The method of claim 52, wherein the stepof performing an extended presence/absence confidence analysis tosubclassify the defects further comprises: for each presence/absencebox, determining a presence/absence classification and computing apresence/absence confidence for each feature-box; spatially clusteringsimilar confidence feature boxes; and applying spatial heuristic rulesto each feature box cluster to determine presence/absence defectsubclassifications.
 59. The method of claim 58, wherein thepresence/absence defect subclassifications include skewed, tombstoned,billboarded, damaged, new, and wrong components, and foreign material.60. The method of claim 59, wherein the features comprise an arbitrarygeometry.
 61. An image recognition computer software program for dynamicimage recognition for making determinations about regions of interest onan object, the image recognition computer program stored in acomputer-readable form on a tangible storage medium and executable by aprocessor to: load a knowledge base containing a set of features andpast decision confidences for each region of interest for the object tobe imaged; acquire a raw gray level image of the object comprising a setof raw pixels, each raw pixel having a gray level value; derive a numberof distinct spaces from the raw pixel image; score each feature for eachregion of interest on each of the derived spaces; classify each featurefor both presence/absence and polarity; calculate decision confidencefor each feature; and calculate a relative decision confidence for eachfeature to provide a metric that compares the decision confidence foreach feature to past decision confidences for the feature contained inthe knowledge base; and if the relative decision confidence is outsideof a predetermined window, classify the feature as a defect and performan extended relative confidence analysis to subclassify the defect. 62.The program of claim 61, wherein, in order to derive the number ofdistinct spaces, the image recognition software program is executableto: derive a reduced zero order magnitude space; derive a reduced firstorder magnitude space; derive a first order direction space; derive areduced second order magnitude space; and derive a second orderdirection space.
 63. The program of claim 62, wherein the imagerecognition software program is further executable to derive the numberof distinct spaces by: deriving the reduced zero order magnitude spaceby reducing each raw image pixel gray level value to a zero orderreduced gray level value according to a zero order reduction transform;deriving the reduced first order magnitude space by creating a firstorder magnitude space by determining the maximum difference between theraw pixel gray level value for each pixel and its eight immediatelyadjacent pixels and then reducing the first order magnitude spaceaccording to a first order reduction transform; deriving the first orderdirection space from the raw image by determining a first orderdirection code for each pixel according to a first order direction map;deriving the reduced second order magnitude space by creating a secondorder magnitude space from the first order magnitude space bydetermining the maximum difference between the first order pixel graylevel value for each pixel and its eight immediately adjacent pixels andthen reducing the second order magnitude space according to a secondorder reduction transform; deriving the second order direction spacefrom the first order magnitude space by determining a second orderdirection code for each pixel based on the direction of the lowest ofthe eight adjacent pixels from each pixel according to a second orderdirection map.
 64. The program of claim 63, wherein the zero gray scalereduction transform reduces pixels values from 256 to N values, thefirst order reduction transform reduces pixel values from 256 to Nvalues, and the second order reduction transform reduces pixel valuesfrom 256 to N values, and wherein the first order direction map providesfirst order direction codes based on the direction of the lowest rawgray level value of the eight adjacent pixels and the second orderdirection map provides second order direction codes based on thedirection of the lowest first order gray level value of the eightadjacent pixels.
 65. The program of claim 64, wherein the imagerecognition software is further executable to perform a histogram on theimage to be reduced to determine a set of change over points for eachreduced code.
 66. The program of claim 64, wherein N is less than 256.67. The program of claim 65, wherein deriving the zero, first and secondorder magnitude spaces further comprises performing a ramping to giveeach pixel near a change over code point a relative code value.
 68. Theprogram of claim 67, wherein the ramp is a zero to five ramp across afive pixel horizontal range.
 69. The program of claim 61, furthercomprising executing the image recognition software to preprocess eachregion of interest in order to perform on each region of interest (1)scaling, (2) gain and offset correction, and (3) gamma correction. 70.The program of claim 62, wherein the image recognition software isfurther executable to score the features by: creating a knowledge basefor presence/absence by: generating each presence/absence feature foreach derived space from at least one blank object; scoring eachpresence/absence feature for each derived space from a first blankobject; and scoring each presence/absence feature for each derived spacefrom every other blank object imaged; creating a knowledge base forpolarity by: generating each polarity feature for each derived spacefrom a first assembled object; rotating the feature images to generatewrong polarity features; and scoring each polarity feature for eachderived space for every assembled object imaged.
 71. The program ofclaim 70, wherein each presence/absence feature generated and eachpolarity feature generated has an arbitrary geometry based on a set offeature generation rules.
 72. The program of claim 70, wherein thenumber of presence/absence features and the number of polarity featuresgenerated in each derived space is not predetermined prior togeneration.
 73. The program of claim 72, wherein the image recognitionsoftware is further executable to score the features by: scoringfeatures in each direction space by giving each feature a score equal tothe number of direction codes on the image that match the directioncodes of the feature in the knowledge base according to the formula:SCORE (K)=ΣP(i,j) for P(i,j)εBB _(k) where P(i,j)=1, if code (P)=code(K) 0, otherwise; and where K is a feature, BB_(k) is a bounding boxbounding feature K, and P(i,j) are the pixels within feature K.
 74. Theprogram of claim 70, further comprising executing the image recognitionsoftware to prune the features in the knowledge base.
 75. The program ofclaim 74, further comprising executing the image recognition softwareto: determine a mean and standard deviation for a predetermined sampleof imaged objects for both presence/absence feature scores and polarityfeature scores; calculate a pruning constant for both presence/absenceand polarity; and select the presence/absence features and the polarityfeatures to be used for scoring based upon predetermined pruning rules.76. The program of claim 75, wherein the predetermined pruning rulescomprise 1) remove all features with minimum pruning constants less than0.5, 2) keep a maximum of 50 features, and 3) keep the maximum pruningconstants.
 77. The program of claim 61, wherein the knowledge basecomprises a database containing a set of features and scores for eachregion of interest.
 78. The program of claim 61, wherein executing theimage recognition software to derive a number of distinct spaces furthercomprises executing the image recognition software to: derive a reducedzero order magnitude space; derive a reduced first order magnitudespace; derive a first order direction space; derive a reduced secondorder magnitude space; derive a second order direction space; derive areduced third order magnitude space; and derive a third order directionspace.
 79. The program of claim 61, further comprising executing theimage recognition software to: perform a set of clustering rules on thederived spaces to create an arbitrary number of presence/absencefeatures, each presence/absence feature having an arbitrary geometry andan arbitrary number of polarity features, each polarity feature havingan arbitrary geometry.
 80. A knowledge base creation computer softwareprogram stored on in computer-readable format on a tangible storagemedium, the program for use in image recognition for images on a set ofderived spaces using at least one bland object and one assembled object,the program executable by a processor to: create a presence/absenceknowledge base by: generating a set of presence/absence features foreach derived space from at least one blank object; scoring eachpresence/absence feature for each derived space from a first blankobject; and scoring each presence/absence feature for each derived spacefrom every other blank object and each assembled object imaged; create apolarity knowledge base by: generating a set of polarity features foreach derived space from a first assembled object; rotating the eachfeature image to generate a set of wrong polarity features; and scoringeach polarity feature for each derived space for every assembled objectimaged.
 81. The program of claim 80, wherein each presence/absencefeature generated and each polarity feature generated has an arbitrarygeometry based on a set of feature generation rules.
 82. The program ofclaim 80, wherein the number of presence/absence features and the numberof polarity features generated in each derived space is notpredetermined prior to generation.
 83. The program of claim 80, whereinscoring the features further comprises scoring features in eachdirection space by giving each feature a score equal to the number ofdirection codes on the image that match the direction codes of thefeature in the knowledge base according to the formula: SCORE(K)=ΣP(i,j) for P(i,j)εBB _(k) where P(i,j)=1, if code (P)=code (K) 0,otherwise; and where K is a feature, BB_(k) is a bounding box boundingfeature K, and P(i,j) are the pixels within feature K.
 84. The programof claim 80, wherein the knowledge base creation program is furtherexecutable to prune the features in the knowledge base.
 85. The programof claim 84, wherein the knowledge base creation program is furtherexecutable to: determine a mean and standard deviation for apredetermined sample of imaged objects for both presence/absence featurescores and polarity feature scores; calculate a pruning constant forboth presence/absence and polarity; and select the presence/absencefeatures and the polarity features to be used for scoring based uponpredetermined pruning rules.
 86. The program of claim 85, wherein thepredetermined pruning rules comprise 1) remove all features with minimumpruning constants less than 0.5, 2) keep a maximum of 50 features, and3) keep the maximum pruning constants.
 87. The program of claim 80,wherein the knowledge base initially comprises a database containing aset of features and scores.
 88. The program of claim 80, wherein theknowledge base creation program is further executable to: derive areduced zero order magnitude space; derive a reduced first ordermagnitude space; derive a first order direction space; derive a reducedsecond order magnitude space; and derive a second order direction space.89. The program of claim 80, wherein the knowledge base creation programis further executable to perform a set of clustering rules on thederived spaces to create an arbitrary number of presence/absencefeatures, each presence/absence feature having an arbitrary geometry andan arbitrary number of polarity features, each polarity feature havingan arbitrary geometry.
 90. A system for dynamic image recognition formaking determinations about regions of interest on an object,comprising: a processor; and an image recognition computer programstored in computer-readable form on a tangible storage medium, the imagerecognition computer program executable to: acquire a raw gray levelimage of the object comprising a set of raw pixels, each raw pixelhaving a gray level value; derive a number of distinct spaces from theraw pixel image; cluster the raw pixel images for each distinct spacebased on a set of clustering rules; and generate a set of features foreach region of interest in each distinct space, each feature having anarbitrary geometry.
 91. The system of claim 90, further comprisingexecuting the image recognition software program to: load a knowledgebase containing a set of features and past decision confidences for eachregion of interest for each derived space for the object to be imaged;score each feature for each region of interest on each of the derivedspaces; classify each feature for both presence/absence and polarity;calculate decision confidence for each feature; and calculate a relativedecision confidence for each feature to provide a metric that comparesthe decision confidence for each feature to past decision confidencesfor the feature contained in the knowledge base; and if the relativedecision confidence is outside of a predetermined window, classify thefeature as a defect perform an extended relative confidence analysis tosubclassify the defect.
 92. The system of claim 91, wherein executingthe image recognition software to derive a number of distinct spacescomprises executing the image recognition software to: derive a reducedzero order magnitude space; derive a reduced first order magnitudespace; derive a first order direction space; derive a reduced secondorder magnitude space; and derive a second order direction space. 93.The system of claim 92, wherein the image recognition software programis further executable to: derive the reduced zero order magnitude spaceby reducing each raw image pixel gray level value to a zero orderreduced gray level value according to a zero order reduction transform;derive the reduced first order magnitude space by creating a first ordermagnitude space by determining the maximum difference between the rawpixel gray level value for each pixel and its eight immediately adjacentpixels and then reducing the first order magnitude space according to afirst order reduction transform; derive the first order direction spacefrom the raw image by determining a first order direction code for eachpixel based on the direction of the lowest of the eight adjacent pixelsfrom each pixel according to a first order direction map; derive thereduced second order magnitude space by creating a second ordermagnitude space from the first order magnitude space by determining themaximum difference between the first order pixel gray level value foreach pixel and its eight immediately adjacent pixels and then reducingthe second order magnitude space according to a second order reductiontransform; and derive the second order direction space from the firstorder magnitude space by determining a second order direction code foreach pixel based on the direction of the lowest of the eight adjacentpixels from each pixel according to a second order direction map. 94.The system of claim 93, wherein the zero gray scale reduction transformreduces pixels values from 256 to N values, the first order reductiontransform reduces pixel values from 256 to N values, and the secondorder reduction transform reduces pixel values from 256 to N values, andwherein the first order direction map provides first order directioncodes based on the direction of the lowest raw gray level value of theeight adjacent pixels and the second order direction map provides secondorder direction codes based on the direction of the lowest first ordergray level value of the eight adjacent pixels.
 95. The system of claim94, wherein the image recognition software is further executable toperform a histogram on the image to be reduced to determine a set ofchange over points for each reduced code.
 96. The system of claim 94,wherein N is less than
 256. 97. The system of claim 91, wherein theimage recognition software is further executable to: create apresence/absence knowledge base by: generating each presence/absencefeature for each derived space from at least one blank object; scoringeach presence/absence feature for each derived space from a first blankobject; and scoring each presence/absence feature for each derived spacefrom every other blank object and each assembled object imaged; create apolarity knowledge base by: generating each polarity feature for eachderived space from a first assembled object; rotating the feature imagesto generate wrong polarity features; and scoring each polarity featurefor each derived space for every assembled object imaged.
 98. The systemof claim 97, wherein the number of presence/absence features and thenumber of polarity features generated in each derived space is notpredetermined prior to generation.
 99. The system of claim 97, whereinthe image recognition software is further executable to: score featuresin each direction space by giving each feature a score equal to thenumber of direction codes on the image that match the direction codes ofthe feature in the knowledge base according to the formula: SCORE(K)=ΣP(i,j) for P(i,j)εBB_(k) where P(i,j)=1, if code (P)=code (K) 0,otherwise; and where K is a feature, BB_(k) is a bounding box boundingfeature K, and P(i,j) are the pixels within feature K.
 100. The methodof claim 99, wherein the image recognition software is furtherexecutable to: determine a mean and standard deviation for apredetermined sample of imaged objects for both presence/absence featurescores and polarity feature scores; calculate a pruning constant forboth presence/absence and polarity; select the presence/absence featuresand the polarity features to be used for scoring based uponpredetermined pruning rules; and prune the features in the knowledgebase.
 101. A system for dynamic image recognition, comprising: aprocessor; and an image recognition computer software program stored incomputer-readable form on a storage medium and executable to: collectraw image data from at least one imaged object; segment out a region ofinterest; perform at least one spatial image transform to generate a setof derived spaces for the region of interest; and cluster the region ofinterest to generate a set of features for each derived space based on aset of clustering rules to generate arbitrary features on the region ofinterest for each derived space.
 102. The system of claim 101, whereinthe image recognition software is further executable to perform aspatial image transform to generate a set of derived spaces for theregion of interest, comprising: deriving a reduced zero order magnitudespace; deriving a reduced first order magnitude space; deriving a firstorder direction space; deriving a reduced second order magnitude space;and deriving a second order direction space.
 103. The system of claim102, wherein the image recognition program is further executable to:derive the reduced zero order magnitude space by reducing each raw imagepixel gray level value to a zero order reduced gray level valueaccording to a zero order reduction transform; derive the reduced firstorder magnitude space by creating a first order magnitude space bydetermining the maximum difference between the raw pixel gray levelvalue for each pixel and its eight immediately adjacent pixels and thenreducing the first order magnitude space according to a first orderreduction transform; derive the first order direction space from the rawimage by determining a first order direction code for each pixelaccording to a first order direction map; derive the reduced secondorder magnitude space by creating a second order magnitude space fromthe first order magnitude space by determining the maximum differencebetween the first order pixel gray level value for each pixel and itseight immediately adjacent pixels and then reducing the second ordermagnitude space according to a second order reduction transform; andderive the second order direction space from the first order magnitudespace by determining a second order direction code for each pixel basedon the direction of the lowest of the eight adjacent pixels from eachpixel according to a second order direction map.
 104. The system ofclaim 101, wherein the image recognition software performs each step ona plurality of regions of interest.
 105. The system of claim 101,wherein the image recognition software program is further executable to:create a presence/absence knowledge base by: generating eachpresence/absence feature for each derived space from at least one blankobject; scoring each presence/absence feature for each derived spacefrom a first blank object; and scoring each presence/absence feature foreach derived space from every other blank object and each assembledobject imaged; and create a polarity knowledge base by: generating eachpolarity feature for each derived space from a first assembled object;rotating the feature images to generate wrong polarity features; andscoring each polarity feature for each derived space for every assembledobject imaged.
 106. The system of claim 104, wherein the imagerecognition software is further executable to: score features in eachdirection space by giving each feature a score equal to the number ofdirection codes on the image that match the direction codes of thefeature in the knowledge base according to the formula: SCORE(K)=ΣP(i,j) for P(i,j)εBB _(k) where P(i,j)=1, if code (P)=code (K) 0,otherwise; and where K is a feature, BB_(k) is a bounding box boundingfeature K, and P(i,j) are the pixels within feature K.
 107. A system forperforming basic training in a dynamic image recognition system,comprising: a processor; and a training computer software program storedin computer-readable form on a storage medium and executable to: collectraw image data from at least one blank object; segment out a region ofinterest on the at least one blank object; perform at least one spatialimage transform to generate a set of derived spaces for the region ofinterest; generate a set of presence/absence features for the at leastone blank object, comprising; spatially clustering similarpresence/absence pixel codes in each derived space to create a set ofpresence/absence features; and representing each significantpresence/absence feature as one or more presence/absence boxes; scoreeach presence/absence box on each blank object, thereby building a blankobject presence/absence score set; collect raw image data from at leastone assembled object; segment out a region of interest on the at leastone assembled object; perform at least one spatial image transform togenerate a set of derived spaces for the region of interest; score eachpresent/absence box on each assembled object, thereby building anassembled board presence/absence score set; build a presence/absenceknowledge base using the blank object presence/absence score set and theassembled object presence absence score set; prune each presence/absencebox; generate a set of polarity features from a first assembled object,comprising; spatially clustering similar polarity pixel codes in eachderived space to create at least one polarity feature; and representingeach significant polarity feature as one or more polarity boxes; scoreeach polarity box on each assembled object, thereby building anassembled object score set; build a polarity knowledge base using theassembled object score set; and prune each polarity box.
 108. The systemof claim 107, further comprising an inspection software program storedon a tangible storage medium and executable to perform inspection of anobject by: collecting raw image data from the object; segmenting out aregion of interest on the object; performing at least one spatial imagetransform to generate a set of derived spaces for the region ofinterest; generating a set of presence/absent feature boxes and a set ofpolarity feature boxes for the object; determining the presence and orabsence of each feature within the set of feature boxes, comprising;scoring the presence/absence feature boxes for the object; passing thepresence/absence feature box scores for the object through the presenceabsence knowledge base; calculating a presence/absence decisionconfidence for each feature; calculating a presence/absence relativeconfidence for each feature to provide a metric to compare eachpresence/absence decision confidence for each feature to a set of pastpresence/absence decision confidences for each feature; and if therelative decision confidence is outside of a predetermined window,classify the feature as a defect and performing an extendedpresence,/absence relative confidence analysis to subclassify thedefect.
 109. The system of claim 108, wherein the inspection program isfurther executable to: determine the polarity of each feature within theset of feature boxes by: scoring each polarity feature box; passing eachpolarity feature box score through the polarity knowledge base,comprising; generate a polarity decision confidence for each feature;calculate a polarity relative decision confidence for each feature toprovide a metric to compare each polarity confidence for each feature toa set of past polarity decision confidences for each feature; and if thepolarity relative decision confidence is outside of a predeterminedwindow, classify the feature as a defect.
 110. The system of claim 109,wherein the training program is further executable to performincremental training to update the presence/absence and polarityknowledge bases.
 111. The system of method of claim 106, wherein thepresence/absence defect subclassifications include skewed, tombstoned,billboarded, damaged, new, and wrong components and foreign material.112. The system of claim 108, wherein the inspection program is furtherexecutable to perform a presence/absence relative confidence analysis todetect presence/absence component level defects by: computing a mean (μ)and standard deviation (δ) over a sliding window of the presence/absencedecision confidences; and flagging any presence/absence decision havinga confidence level outside a predetermined window.
 113. The system ofclaim 112, wherein the predetermined window includes values of μ±kδwhere k is a relative confidence flag boundary.
 114. The system of claim108, wherein the inspection program is further executable to perform anextended presence/absence confidence analysis to subclassify the defectsby: for each presence/absence box, determining a presence/absenceclassification and computing a presence/absence confidence for eachfeature box; spatially clustering similar confidence feature boxes; andapplying spatial heuristic rules to each feature box cluster todetermine presence/absence defect subclassifications.